Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all 7205 articles
Browse latest View live

How to access a nested ListView from the parent DetailView's controller and parent DetailView from the nested ListView's controller

$
0
0

This example is based on the following facts:


1. The nested ListView is shown in the parent DetailView via the ListPropertyEditor. The ListPropertyEditor class has the Frame property that returns the nested frame and the ListView property that returns the nested ListView. To get the ListPropertyEditor, use the DetailView.FindItem or DetailView.GetItems method.


2. The nested list view's frame is represented by the NestedFrame class that has the ViewItem property, which returns the ListPropertyEditor from the parent DetailView. It is possible to access the parent DetailView via the ListPropertyEditor's View property.


Note that this code is required only if you need to access views and frames. If you need to access child business objects from the parent DetailView, simply get the DetailView's CurrentObject, cast it to the corresponding type and use its collection property. If you need to access the parent object from the nested ListView, use the PropertyCollectionSource.MasterObject property, as shown in the How to: Access the Master Object from a Nested List View help topic.

Question Comments

Added By: Krzysztof Krzyzsłof at: 7/10/2014 1:10:39 AM    

Works in both WIN and WEB.


How to create a GridView descendant class and register it for design-time use

$
0
0

This is an example of a custom GridView and a custom control that inherits the DevExpress.XtraGrid.GridControl. Make sure to build the project prior to opening Form1 in the designer. Please refer to the How to create a GridView descendant class and register it for design-time use Knowledge Base article for the additional information.

In addition, you can refer to How to create a WinExplorerView descendant class and register it for design-time useHow to create a LayoutView descendant class and register it for design-time useHow to create a CardView descendant class and register it for design-time useHow to create a AdvBandedGridView descendant class and register it for design-time useHow to create a BandedGridView descendant class and register it for design-time use to learn more how to create other GridControl view descendants.

How to: Bind Commands in the WinForms MVPVM application

How to hide an empty Grand Total column

$
0
0

This example illustrates how to use the ASPxPivotGrid.CustomFieldValueCells event to totally hide an empty Grand Total column.

Question Comments

Added By: Ram dasari at: 7/10/2014 4:54:51 AM    

This code does not hide an  empty grand total column but instead hides all columns.

Added By: Constant (DevExpress Support) at: 7/10/2014 7:20:38 AM    

Yes, this is the expected behavior. If you wish to hide specific grand total columns corresponding to a specific Data Field, it is necessary to set the corresponding PivotGridField.Options.ShowGrandTotal Property to false. Please try this solution and let me know your results. 

How to use DevExpress themes in a WPF Application

$
0
0

This example demonstrates all common ways of using themes in your application.

DevExpress provides multiple themes that can be applied to all DevExpress WPF controls and some standard controls (GroupBox, ScrollViewer, Scroll, RadioButton, Button, ListBox, Slider, TabControl, Separator, ToggleButton, RepeatButton, Label, ListBoxItem, TabItem, ToolTip, etc.). All built-in themes are described in the following article: DevExpress WPF Themes.

The easiest way to apply a particular theme to the application is to specify the static ThemeManager.ApplicationThemeName property.

To set a theme for a specific element, use the ThemeManager.ThemeName attached property:

 

[XAML]
xmlns:dx=http://schemas.devexpress.com/winfx/2008/xaml/core<TextBoxName="textBox1"dx:ThemeManager.ThemeName="MetropolisLight"Width="120"Height="23"/>

 

In this case, the theme will be applied to the element and all its child elements.

Keep in mind these simple rules when applying DevExpress themes:

1. The ThemeManager.ApplicationThemeName property has lower priority than the ThemeManager.ThemeName property set locally.

2. The ThemeManager.ThemeName property value set for a parent element may be changed for its child if you explicitly specify the ThemeManager.ThemeName property for it.

In some cases, you may need to retrieve a list of all available DevExpress themes. The static Theme.Themes property contains this information.

 

How to export GridView data to different rich text formats

$
0
0

This example is standalone implementation of the online Grid View - Exporting Data demo.
It illustrates how to export the GridView 's content to several rich text formats via the ExportTo*** methods.

This example is an illustration of the KA18639: How to export GridView rows and keep end-user modifications (such as sorting, grouping, filtering, selection) KB Article. Refer to the Article for an explanation.

Please note the following key moments:
- The GridView Extension should be defined via a separate PartialView without any additional tags (see the Using Callbacks help topic for more information);
- The GridView's PartialView should be wrapped within a form in order to apply the client layout state (sorting, filtering, etc.);
- An export trigger should submit this form to the corresponding Controller Action (i.e., make a POST request);
- The GridViewSettings (especially the Name property) should be the same in PartialView and Controller;
- The datasouce/Model should be the same in PartialView and Controller.

Question Comments

Added By: Nurhak Kaya at: 9/4/2012 7:58:55 AM    

Really good! Thanks a lot!

Added By: Steven Jansick at: 7/11/2014 11:44:57 AM    

Does this work when binding with BindToCustomData?

I have verified that all of the Conditions have been met but when I export, it is not maintaining the Grouping Order.  Do you have any recommendations?

How to display an image in GridControl

$
0
0

This example demonstrates how to use RepositoryItemPictureEdit to display an image in GridView. The same approach can be used for any View.

Question Comments

Added By: Adam Nowicki at: 7/13/2014 3:00:14 AM    

The solution works well. The problem is filtering through AutoFilterRow and sorting. In the column with image is written "No image data" and you can not use a filter. Please solution how applied in this case AutoFilterRow and sorting to this column.

Lesson 3 - Create a WinForms MVPVM applicaiton with multiple Views


How to display underlying data for dashboard items displayed in the WinForms Viewer

$
0
0

The following example demonstrates how to obtain underlying data corresponding to a particular visual element using the DashboardViewer's API.

In this example, the DashboardItemClick event is handled to obtain underlying data and display this data in the grid.

In the event handler, the GetUnderlyingData method is called to obtain records from the dashboard's data source.

How to customize required, optional and invalid editor styles via CSS

$
0
0

This sample demonstrates how to define the required, normal (optional) and invalid styles of DevExpress editors by modifying specific service DevExpress CSS classes. Note that overriding the DevExpress CSS classes shown in this example affects the appearance of all DevExpress editors on the page regardless of the applied DevExpress Theme.

Menu - How to load a content using callbacks on a menu item click based on the DevExpress Project template

How to customize grid lines, grid snapping of the chart range control client

$
0
0
This example demonstrates how the grid lines and grid snapping of the chart within the range control's viewport can be customized at runtime.

How to bind SchedulerControl to SQL Server database

$
0
0

This example demonstrates how to bind the SchedulerControl to a database located in MS SQL Server 2005.

The basic steps to create this example are equivalent to the steps described in Lesson 1 - Bind a Scheduler to Data. However, several additional steps are added to demonstrate more SchedulerControl capabilites:

- Resources for appointments
Besides the appointment mappings, resource mappings are defined in the SchedulerStorage. A separate TableAdapter is used to retrieve resources from the database.

- Resource sharing
The AppointmentStorageBase.ResourceSharing Property value is set to true (note the It is impossible to set ResourceSharing property to true via XAML bug report).

To test this example locally, you should setup our CarsXtraScheduling sample database in your SQL Server instance (you can download the corresponding *.sql scripts from the How to bind ASPxScheduler to MS SQL Server database example).

Question Comments

Added By: Arti Vengurlecar at: 7/15/2014 2:10:58 AM    

How to generate Dataset using SQL server?

How to adjust the ASPxComboBox width according to its content

$
0
0

This example demonstrates how to adjust the ASPxComboBox width according to its content. To accomplish this, handle the ASPxClientComboBox.SelectionChanged and ASPxClientComboBox.Init events, and call the AdjustWidth function in both event handlers.

ASPxGridView - How to implement cascading comboboxes in Batch Edit mode

$
0
0

The concept of cascading combo boxes requires sending a callback to the server to get data for the second editor based on the first editor's selected value. 
In the meantime, it's impossible to send callbacks for built-in editors and it's necessary to use the EditItemTemplate (see ASPxGridView - Batch Edit - Support a scenario when GridViewComboBoxColumn is used in callback mode).
A basic scenario of this approach requires the following steps:
1) Use the client-side ASPxClientGridView.BatchEditStartEditing  and ASPxClientGridView.BatchEditEndEditing  events  to provide the template combo box with values.
2) Handle the SelectedIndexChanged event to send callbacks if it's required.
3) Handle the ASPxClientComboBox.EndCallback event for the second editor to apply the selected item after a callback.
4) Handle the ASPxClientGridView.Init  and ASPxClientGridView.EndCallback events  to initialize and reset global variables responsible for data providing logic after the grid was refreshed. 
 
The attached example illustrates how to implement all these steps.


How to register a custom filter function and use it in GridControl

$
0
0

Starting from version 11.1 it is possible to register a custom function globally .

To create this function, it is necessary to implement the ICustomFunctionOperatorBrowsable interface. If you wish your custom function to be evaluated on the server side (for instance, when Server Mode is used) it is necessary to implement the ICustomFunctionOperatorFormattable interface.
Finally, to register a custom function you should call the CriteriaOperator.RegisterCustomFunction method with your custom function instance at the application startup.

To show a custom function, for instance, within a column DateTime filter dropdown handle the GridView.ShowFilterPopupDate event. In this event handler create a FunctionOperator instance and pass your custom function name to its constructor. Then, add this FunctionOperator to the e.List collection.

Also, it is possible to use a custom function within FilterEditorControl. To use the FilterEditorControl rather than a regular FilterControl in a grid, set the GridView.OptionsFilter.DefaultFilterEditorView property to any value except for Visual. So, you can enter your function in the FilterEditorControl by choosing the Text tab.

This example illustrates how to add a custom function that will determine whether or not a processed date is a day off and show it in a column DateTime filter dropdown.

RibbonControl - How to implement the SaveLayoutToStream / RestoreLayoutToStream methods

$
0
0

This example illustrates how to save the RibbonControl layout to a stream and when to restore it.

Question Comments

Added By: Manuela Nikolay at: 7/15/2014 5:33:27 AM    

Hallo,

I have DevExpress v 14.1 installed

but RibbonControl have not SaveLayoutToStream or RestoreLayoutToStream Method

??

Added By: Alisher (DevExpress Support) at: 7/15/2014 7:08:49 AM    Hi Manuela,

RibbonControl does not have these methods. This example is created to illustrate how to introduce them manually. 

Let me know if you have additional questions.

How to use HtmlEditor for editing GridView data

$
0
0

This example demonstrates how to use HtmlEditor to edit GridView row data

Question Comments

Added By: md imran at: 11/18/2013 5:20:50 AM    

please can you give me the full project and i want to edit and delete on right click context menu not clicking on the grid view........ Thanks please answer me fast as possible as you can............

Added By: md imran at: 11/18/2013 5:21:29 AM    

same as below gridview with html editor

Added By: Vladimir (DevExpress Support) at: 11/19/2013 9:59:25 PM    

Hello,

I am not sure that I correctly understand the details of your request. If you need this example project, you can download it by clicking the 'Example' link on the right. I recommend you also install Example Runner, which you can get by clicking the 'Example Runner' link. You can find it under the 'Example' link.
If you need to apply some changes to this scenario, but you encounter certain difficulties doing so, would you please create a separate ticket and describe the issue in greater detail? If possible, also send us a sample project to illustrate the encountered difficulties. This will help us understand their cause and provide you with a detailed answer.

Added By: Luis Ramirez 12 at: 7/15/2014 9:09:27 AM    

Good Morning.
Can you help me with one thing. I need to do exact the same thing (put a HTML Control in the editing form of a Grid View) but in ASP .Net.
Actually I'm using this code:

<dx:GridViewDataMemoColumn FieldName="Texto" Visible="false" VisibleIndex="10" EditFormSettings-ColumnSpan="2" PropertiesMemoEdit-Height="75px">
                                   <PropertiesMemoEdit Height="75px" Width="100%" EncodeHtml="False"></PropertiesMemoEdit>
                                   <EditFormSettings Visible="True" />
                               </dx:GridViewDataMemoColumn>

But I have to use the HTML Editor control.

Thanks.

Added By: Artem (DevExpress Support) at: 7/15/2014 11:08:24 PM    

Hello,

To process your recent post more efficiently, we copied it to a separate ticket created on your behalf: T129913: How to use ASPxHtmlEditor in ASPxGridView.
This ticket is currently in our processing queue. We will post to it as soon as we have any updates.

How to refresh the Field List in the End-User Designer

$
0
0

This example demonstrates how to programmatically update the Field List in the End-User Designer. This may be required when a data source is created and bound to a report at runtime, and isn't present in the designer host of the End-User Designer. For instance, this situation occurs when a data source is represented by a list (e.g. ArrayList), as demonstrated in the sample below.

To accomplish this task, we've introduced the FieldListDockPanel.UpdateDataSource method, which should be called after assigning a data source to a report.

Question Comments

Added By: BGood2 at: 3/27/2014 3:59:31 PM    

Tried this sample with v13.2.8 in Visual Studio 2012 on Windows 7 32 bit VM. Menu item "Bind to a DataSource" is disabled after the app starts.

If I bypass the code in Form1_Load and don't call xrDesignPanel1.ExecCommand(ReportCommand.NewReport);, the menu item is enabled, but the code in BindReportToData() fails because xrDesignPanel1.Report is null.

Suggestions?

Added By: Nikola Lukovic at: 7/15/2014 12:03:02 AM    

This example isn't working :/

Added By: Vasily (DevExpress Support) at: 7/16/2014 3:59:45 AM    

Hello Nikola ,

To process your recent post more efficiently, we copied it to a separate ticket created on your behalf: T130097: How to refresh the Field List in the End-User Designer code example is not working.
This ticket is currently in our processing queue. We will post to it as soon as we have any updates.

How to customize series of a chart range control client at runtime

$
0
0
This example shows how to adjust series of a numeric chart range control client using the ChartRangeControlClientBase.CustomizeSeries event. This event occurs before a series of the chart range control client is drawn in the range control's viewport.

Use the ClientDataSourceProviderCustomizeSeriesEventArgs.View property to change the series view of the chart range control client. In addition, you can access the data source value using the ClientDataSourceProviderCustomizeSeriesEventArgs.DataSourceValue property.

Viewing all 7205 articles
Browse latest View live