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

How to: Navigate between Views via FrameNavigationService

$
0
0

The FrameNavigationService provides methods to navigate between Views within a NavigationFrame. This example shows how to use this service.


In this example, the MainWindow contains a NavigationFrame, which shows a HomeView at startup. The HomeView contains a Tile, which invokes a command to navigate to a DetailView when clicked. The DetailView contains the Back button for backward navigation.



How to enable the Multi Selection feature in VGridControl

$
0
0

These examples illustrate how to enable the Multi Selection feature in the VGridControl. Simply place the SelectionProvider component onto a form. Since this component implements the IExtenderProvider interface, the MultiSelect property will be shown for the VGridControl in the Visual Studio Property Grid. So, you will be able to turn this option on at design time. At runtime, use the SelectionProvider.SetMultiSelect method.


In short, selection operates in a similar manner as in the GridControl. By holding SHIFT, you can select cell ranges while by holding CTRL, you can select individual cells. In addition, category rows can be selected as well.


In the case of a MultiEditorRow, separate cells within this row can be selected by holding CTRL. If you hold SHIFT, a whole MultiEditorRow will be selected.

How to: Create Information Panels

$
0
0

This example shows how you can create information panels. The complete description is available in the How to: Create Information Panels help topic.


Example Comments

Added By: Willem de Vries at: 12/17/2012 10:36:33 PM    

I'd like to see how the current skin can be applied to the panel.

Added By: Konstantin B (DevExpress) at: 12/21/2012 3:10:33 AM    

Hi Willem. You can see it in the FeatureCenter demo ("Frame Templates" | "Info Panels" section).

How to use Criteria Property Editors

DockPanel - How to create DockPanels dynamically and persist their state to cookies

$
0
0

This example illustrates how to add DockPanel to the view dynamically and restore their layout from cookies when view page is reloaded. We are using the approach from the How to use the jQuery.ajax function with DevExpress MVC Extensions code example to generate a new DockPanel on the server side and add its resulting HTML to the view page:

[JScript]
$.ajax({ url: '@Url.Action("DockPanelPartial", "Home")', type: "POST", data: { index: count }, success: function(response){ $(response).appendTo('#ajaxDiv'); ASPxClientUtils.SetCookie("panelsCount", count + 1);}});

In addition, make a note of the code used to restore previously created DockPanels:

[C#]
<divid="ajaxDiv">@* Restore old panels: *@@if(Request.Cookies["panelsCount"]!=null){intpanelsCount=Convert.ToInt32(Request.Cookies["panelsCount"].Value);for(inti= 0;i<panelsCount;i++){Html.RenderAction("DockPanelPartial","Home",new{index=i});}}</div>

ASPxComboBox - How to change a color of text for certain items

$
0
0

This example illustrates how to customize a style for each item. Since the color is changed for an HTML element, it is necessary to synchronize this settings on each round-trip to the server. For this, handle the client-side combo box' Init and EndCallback event.

Note: the GetItemElement method is undocumented and can be changed without any notification with the next release.

How to create persistent classes mapped to tables with a composite primary key at runtime

$
0
0

When you have a table with a composite key, a usual solution is to declare a structure for the key member as described in the A2615 article. If the database schema is not known as design time, and you need to create persistent classes at runtime, there is no option to create a structure-like entity as this functionality is supported only for real types via Reflection. The example demonstrates how to create a custom XPCustomMemberInfo descendant with nested members support.

See also:
K18482: How to create persistent metadata on the fly and load data from an arbitrary table

How to bind SchedulerControl to ObservableCollection

$
0
0

This example illustrates how to bind SchedulerControl appointment and resource storages to ObservableCollection instances in the context of the basic MVVM implementation. Custom appointment and resource objects are represented by the ModelAppointment and ModelResource class instances. The SchedulerViewModel class exposes the collections of these objects. Finally, the corresponding view model properties are specified in binding expressions in the MainWindow.xaml markup file.

In addition, this example illustrates how to access the underlying data objects of a certain appointment. Note that the PersistentObject.GetSourceObject Method is used for this purpose.

Note: Data formats, in which the ModelResource.Color and ModelAppointment.ResourceId property values are specified in the SchedulerViewModel.AddTestData() method, are described in the ResourceStorageBase.ColorSaving Property and How to: Enable Multi-resource Appointments help sections correspondingly.

Example Comments

Added By: Brian Morris 01 at: 4/4/2013 1:54:27 PM    

This example has been very helpful...however, I would really like to move the ObservableCollection to the code behind file, "MainWindow.xaml.cs". When do this, something breaks the binding with Appointments. I have moved all the logic from the SchedulerViewModel.cs file into the "MainWindow.xaml.cs" file and now when I run the project the Scheduler is blank. How can one bind to an ObservableCollection in the code behind file?


How to create a master-detail report in a RichEditControl

$
0
0

This example illustrates an older approach to create master-detail documents with the RichEditDocumentServer, by using the DOCVARIABLE field.

To learn about a newer and more convenient approach to master-detail mail merge, refer to How to automatically create mail-merge documents using the Snap Document Server.


This project uses a three-level Supplier-Product-OrderDetail hierarchical data source that implements the ITypedList interface. The data source implementation is described in the following example: E137: How to create a hierarchical master-detail datasource. Because the GridControl supports displaying hierarchical data sources in the most natural manner, it is used to preview data.

The application screenshot is shown below.

How to create collection properties with associations at runtime

$
0
0

The XPO Library provides the capability to create classes and members at runtime by customizing the metadata dictionary. Besides creating persistent members mapped to database columns, it is also possible to create collection-type members with associations. This example demonstrates both one-to-many and many-to-many associations added to existing persistent classes dynamically and how dynamic properties can be accessed.

Note that all metadata customizations must be done before a data layer is created with the customized dictionary.

See also:
XAF-specifics: How to customize a Business Model at runtime (Example).
Related XPO classes: DevExpress.Xpo.Metadata Namespace

How to show Hierarchical Resources in SchedulerListEditor (WinForms)

$
0
0

The XtraScheduler Suite provides the capability to show hierarchical resources via the Resources Tree control. This scenario is not currently supported in XAF out-of-the-box. The example demonstrates how to employ this feature by creating a custom ShedulerListEditor descendant.

Example Comments

Added By: Willem de Vries at: 4/3/2013 2:24:21 AM    

Thank you DX, for providing this example! This is what i needed to present complex planning info in a comprehensible way to my users!

ASPxGridView - How to set a different color for the modified cell in different columns in Batch Edit mode

$
0
0

To implement this scenario, handle the HtmlDataCellPrepared event and add a custom attribute for each data cell:

     

[C#]
protectedvoidGrid_HtmlDataCellPrepared(objectsender,ASPxGridViewTableDataCellEventArgse){e.Cell.Attributes.Add("fieldName",e.DataColumn.FieldName);}

Then, you can change the cell's color by modified the dxgvBatchEditModifiedCell CSS class based on the "fieldName" attribute of each cell:

[CSS]
.dxgvBatchEditModifiedCell[fieldName="C2"]{background-color:LightCoral!important;}.dxgvBatchEditModifiedCell[fieldName="C3"]{background-color:LightYellow!important;}.dxgvBatchEditModifiedCell[fieldName="C4"]{background-color:LightBlue!important;}.dxgvBatchEditModifiedCell[fieldName="C5"]{background-color:LightSalmon!important;}

How to automatically create mail-merge documents using the Snap Document Server

How to show filter dialog before showing ListView

$
0
0

Scenario:

When a user executes a navigation item that displays a large ListView, the application should display a popup window that allows you to define a filter for this ListView before loading records in it. This filter dialog should remember the user's choice and provide the capability to select one of the stored filters.

Steps to implement:

1. Create a ListView model extender - IModelListViewExt - that adds the AdditionalCriteria property to the ListView model to store the filter selected by the user.

2. Implement the ViewFilterContainer class whose DetailView is used as a filter dialog.

3. Implement the ViewFilterObject class which is used to store filters.

4. Implement the ShowFilterDialogController which shows the filter dialog instead of displaying the ListView, and then shows the filtered ListView. To do this, subscribe to the ShowNavigationItemController.ShowNavigationItemAction.Execute event and replace the ListView from the e.ShowViewParameters.CreatedView property with the ViewFilterContainer DetailView. Then show the filtered ListView via the XafApplication.MainWindow.SetView method.

5. Implement the NewViewFilterObjectController which sets the ObjectType property of the ViewFilterObject object created by the ViewFilterContainer.Filter lookup's New action.

See Also:
How to: Use Criteria Property Editors
How to: Extend the Application Model and Schema
ShowNavigationItemController Class
Dialog Controller

Example Comments

Added By: Pablo Mazaeda 1 at: 11/13/2012 6:21:47 AM    

how do I do this for ASP.NET?

Added By: Mandeep Singh 10 at: 2/16/2014 6:57:38 AM    

Tried to download this Example. Returns the following error

Server Error in '/Support/Center' Application.

Added By: Anatol (DevExpress Support) at: 2/16/2014 11:49:17 PM    

This was likely a temporary issue. Please try to download the example once again.

Added By: Wieland Voß at: 3/4/2014 1:16:39 AM    

Hi Anatol,

how do we implement this solution for the asp.net environment? Simply importing DevExpress.ExpressApp.Web in ViewFilterContainerDetailViewController doesn't seem to meet our needs, since LookupPropertyEditor and LookupEdit are unknown.

Thank you
Wieland

Added By: Anatol (DevExpress Support) at: 3/4/2014 7:57:15 AM    

I have updated the example. Now its code is platform-independent and will work correctly in the ASP.NET project.

How to use SnapDocument events to customize the default templates of Snap lists and columns


How to get additional search results using the Bing Map Search service

$
0
0

This example demonstrates how to provide search for location and keywords using the BingSearchDataProvider.Search method.

In this example, the built-in Search panel is disabled (the BingSearchDataProvider.ShowSearchPanel property is set to false), because a custom panel is used instead.

To start search, specify search parameters (location and a keyword) in the custom Search panel and click the Search button. All search parameters are passed to the Search method and you can see the result in the rich text box element.

The results contain a display name, and address associated with the search location. In addition, the SearchRequestResult.AlternateSearchRegions property returns results of searching for alternate regions.

Note that if you run this sample as is, you will get a warning message saying that the specified Bing Maps key is invalid. To learn how to register a Bing Maps account and create a key for it, refer to the How to: Get a Bing Maps Keytutorial.


How to implement dependent views in a DashboardView (filter based on selection)

$
0
0

This example illustrates how to filter a ListView displayed in a DashboardView based on another ListView's selection.

Scenario
When a DashboardView contains several list views, it is often required to make them dependent, e.g. display items of one ListView based on items or selection of another ListView.

Steps to implement
1. Add a new ViewController to your platform-agnostic module (DashboardFilterController).
2. In the OnActivated method retrieve the necessary DashboardViewItems via the FindItem method. After that subscribe to the ControlCreated event of the DashboardViewItem whose ListView will be used for filtering (hereinafter referred to as SourceView).
3. In the ControlCreated event handler retrieve the SourceView via the DashboardViewItem.InnerView property and subscribe to its SelectionChanged event.
4. In the SelectionChanged event handler retrieve the View that will be filtered (hereinafter referred to as TargetView) in the same manner as in the previous step.
5. To retrieve an object by which filtering will be performed, use the ListView.CurrentObject property. This object must be loaded from SourceView ObjectSpace to TargetView ObjectSpace via the GetObject method.
6. Now you can simply filter the TargetView by adding CriteriaOperator to the TargetView.CollectionSource.Criteria dictionary. In my example, I created a simple InOperator to filter the Position column via objects from SourceView.

Important notes:
The provided algorithm is platform-agnostic. It will work without any additional code in WinForms applications, but in ASP.NET the TargetView will not be refreshed immediately after changing the SourceView's selection. It is required to post changes made on the server side to the client to show them in the browser. That is why I have implemented the DashboardViewRefreshController that will refresh DashboardView when selection in the SourceView is changed. Handle the WebWindow.CurrentRequestWindow.PagePreRender event. In this event handler, find the ASPxGridView, modify its client-side SelectionChanged event and the script using the CallbackManager as shown in the DashboardRefreshController.cs file.
Then deactivate the WebRecordsNavigationController to prevent its activation for the TargetView in the DashboardView. This controller can lead to an exception during navigation to the record's DetailView on a clickin the SourceView. This behavior is caused by the fact that WebRecordsNavigationController lies inside the ListViewand collects information about records when this ListView is disposed of. It collects records based on visible rows, but since we filter the CollectionSource, it does not contain the required object.

How to colorize map contours loaded from Shapefiles using the Choropleth colorizer

$
0
0

This example demonstrates how to paint each map contour in a specific color depending on GDP data from Shapefiles (Countries.dbf, Countries.shp).

How to colorize map contours loaded from Shapefiles using the graph colorizer

$
0
0

This example demonstrates how to paint map contours loaded from Shapefile (Countries.shp) using the graph colorizer.


Date range filtering in the Filter Row

$
0
0

The ASPxGridView has the Filter Row, but unfortunately it doesn't provide the FilterRow template. However since v2009 vol 2 version, the ASPxDropDownEdit control can easily provide its template, which can be used as a filter editor.
This example demonstrates how to filter the range of dates using the similar approach demonstrated in the example E353: Create the Custom Filter Criteria. This example uses the DropDownEditProperties.

Starting with version 13.1, this can be achieved simpler. You can use the FilterCell Template of the ASPxGridView. See a solution for that version.

See Also:
E2203: CheckComboBox filtering in the Auto Filter Row
E1950: ASPxGridView - Date auto filter
E5038: GridView - How to implement date range filtering using a custom editor in the AutoFilterRow

Example Comments

Added By: Gunnar Steinn Magnússon at: 8/24/2012 9:03:41 AM    

Could you please post a suggested way to do implement this with MVCxGridView?

Added By: esa s at: 7/29/2013 6:46:41 AM    

hi, in this sample by clicking twice on the Apply button (without changing dates), the dateSelector control would not be loaded and it will cause an exception in your gridview, would you please check this ? thanks

Viewing all 7205 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>