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

How to save current parameter values to a dashboard XML definition

$
0
0
The following example demonstrates how to save custom data to a dashboard XML definition using the Dashboard.UserData property.

In this example, current dashboard parameter values are saved to the dashboard XML file. Then, saved values are used to set current parameter values in the loaded dashboard.

How to highlight all found word entries in a document

$
0
0

At the moment. a RichEditControl highlights only the currently found entry. This example demonstrates how  to highlight all the found entries. The main idea is to use the custom marks feature. A custom mark is added for each found entry and drawn by the DevExpress.XtraRichEdit.RichEditControl.CustomMarkDraw event.

To manage highlighting when searching is performed using the SearchForm form - a custom SearchForm is created.  

How to perform a drill-down in ASPxDashboardViewer

$
0
0

The following example demonstrates how to perform a drill-down in ASPxDashboardViewer on the client side.

In this example, the ASPxClientDashboardViewer.PerformDrillDown method is used to perform a drill-down for a specified row in a Grid dashboard item. The dxSelectBox widget contains categories for which a drill-down can be performed. These categories are obtained using the ASPxClientDashboardViewer.GetAvailableDrillDownValues method. Select a required category and click the PerformDrillDown button to perform a drill-down by the selected category.

When the Grid displays a list of products (the bottom-most detail level), you can only perform a drill-up action that returns you to the top detail level. The ASPxClientDashboardViewer.PerformDrillUp method is called to do this.

How to apply master filtering in ASPxDashboardViewer

$
0
0

The following example demonstrates how to apply master filtering in ASPxDashboardViewer on the client side.


In this example, the ASPxClientDashboardViewer.SetMasterFilter method is used to select required rows in the Grid dashboard item. This method is called in the Click event handler of the ASPxButton1.

Question Comments

Added By: Mariusz Muszalski at: 10/2/2014 2:16:32 AM    

An exception is raised when trying to set master filter values for more than one items:

Emex.Framework.Web.UI.JavaScriptException: Cannot perform interactivity action. This action is not allowed for the current dashboard item.: at document path 'http://localhost:51001/BI/Dashboard3.aspx';. at ('Cannot perform interactivity action. This action is not allowed for the current dashboard item.', 'http://localhost:51001/DXR.axd?r=1_171,1_94,1_164,1_114,1_121,1_113,1_91,1_156,1_154,1_116,1_93,1_131,15_1,1_128,1_127,15_0,15_5,15_6-qtFv9', '23815', '1803', 'Error: Cannot perform interactivity action. This action is not allowed for the current dashboard item.') at ()

<ClientSideEvents Click="function(s, e) {
WebViewer.SetMasterFilter('gridDashboardItem1',[['UK','Anne Dodsworth'],['USA','Andrew Fuller']]);
WebViewer.SetMasterFilter('gridDashboardItem2',[['UK','Anne Dodsworth'],['USA','Andrew Fuller']]);
           }" />

Added By: Andrew Aks (DevExpress) at: 10/2/2014 3:30:04 AM    I have extracted your question into a separate thread:
https://www.devexpress.com/Support/Center/Question/Details/T157091
Let's continue our discussion there.

How to draw the DockPanel Tab header with a custom Color when Skin is used

$
0
0

The How to implement the custom draw functionality for skinned dock panels example illustrates the most common approach to implement this functionality by raising a custom CustomDrawDockPanelCaption event.

The current example illustrates an alternative approach that allows you to change the dock panel appearance by creating a custom paint style.

To change an active panel tab header appearance, you can create your own SkinBarManagerPaintStyle and override DrawActiveTab in the corresponding DockElementsSkinPainter descendant.

Question Comments

Added By: sivasubramanian at: 11/27/2013 10:16:05 PM    

Please attach the Runnable Sample ASAP. Some code snippets are missing in the below Files.

Added By: Wolfgang Wallhäuser at: 1/29/2015 12:52:16 AM    

For tabbed dock panels, I want to have different text colors on the tab buttons.

Using the sample code, I can change the text color of the selected tab:

     protected override void DrawActiveTab(DrawTabArgs tabArgs)
     {
        tabArgs.Appearance.ForeColor = Color.White;
        base.DrawActiveTab(tabArgs);
     }

By overriding DrawTabPanel, I can change the text color of the other tabs as well:

     public override void DrawTabPanel(DrawTabPanelArgs args)
     {
        args.Appearance.ForeColor = Color.Pink;
        base.DrawTabPanel(args);
     }

But I do not know how to change the text color of a "hot tracked" tab button. Can this be achieved by extending this code?

Added By: Alexey Z (DevExpress Support) at: 1/29/2015 2:01:57 AM    Hello,

In order not to mix several questions within one thread, I will extract your question to a new ticket. Let us continue our discussion there DockPanels - How to change the text color of a "hot tracked" tab button.

How to customize map pie parameters

$
0
0

To customize a MapPie object parameters specify required properties from the following list.
MapPie.Argument - allows specifying the argument of a map pie.
MapPie.Location - allows specifying the location of a map pie.
MapPie.RotationAngle - allows specifying the rotation angle of a map pie.
MapPie.RotationDirection - allows specifying the rotation direction of a map pie.
MapPie.Segments - allows specifying the segments collection included in a map pie.
MapPie.Size - allows specifying the size of a map pie.

Also specifying the following PieSegment parameters allows customizing the map pie appearance.
PieSegment.Argument - allows specifying the argument of a pie segment.
PieSegment.Attributes - allows specifying the attributes collection of a pie segment.
PieSegment.Value - allows specifying the value of a pie segment.

How to connect different ORM data models to several databases within a single application

$
0
0

Scenario

This example demonstrates how to create custom XAF modules with custom business objects and logic that would work with separate databases. These modules do not depend on each other and thus can be reused in other applications as a whole.
Usually, the connection to the database is set up in the executable application project. Typically, it is performed in the configuration file or directly in the code of the application's designer or within the Main function/Global application class. To learn more, please check out this help topic: Connect an XAF Application to a Database Provider In this example, you will learn how to establish a connection to the database directly from your module projects.


Steps to implement

0. Create a new XAF solution using one of predefined project templates;

1. Add two XAF modules into this solution using the DevExpress vXX.X XAF Module project template;

2. Add required persistent classes into these modules as shown in the ClassLibraryN/PersistentClassN.xx files of this example solution;

3. Add service ModuleInfo classes into these modules as shown in the ClassLibraryN/ModuleInfoN.xx files of this example solution;

4. In YourModuleName/Module.xx files, override the Setup(XafApplication application) methods of the ModuleBase descendants to handle the CreateCustomObjectSpaceProvider event of the XafApplication class as shown in the ClassLibraryX/XafModuleN.xx files of this example solution;

5. Build the solution, invoke the Module Designer for the platform-agnostic module (YourSolutionName.Module/Module.xx), and drag the created custom modules from the Toolbox:

Alternatively, you can add the same modules via the Application Designer invoked for the executable projects (as demonstrated in this example).

6. Declare connection strings in the configuration files of your application as shown in the TwoXpoModelsForDifferentDatabases.Web\Web.config and TwoXpoModelsForDifferentDatabases.Win\App.config files (see ConnectionStringDatabaseX under the <connectionStrings/> element). These connection strings are used in the modules via the ConfigurationManager.ConnectionStrings API, but you can always modify the way your modules obtains this data.

Important notes

1. Each module has a single static XPObjectSpaceProvider instance, which is initialized only once during the application life cycle.
2. Each ModuleUpdater class checks whether it is valid to create initial data of a certain type from this module via the IObjectSpace.CanInstantiate method.
3. Business classes linked to different ObjectSpaceProviders are considered to be isolated from each other and thus cannot have any links between them (e.g., direct: there is an association between two classes; indirect: you have a security permission stored in one database, while its target type is mapped to another database). Consider using the How to prevent altering the legacy database schema when creating an XAF application or alternative solutions if you need interlinks between classes from different data stores.

4. If several XPObjectSpaceProvider objects are connected to the same database, then it would be necessary to additionally map the service XPObjectType class to different tables in each XPDictionary. You can do this in the application_CreateCustomObjectSpaceProvider method by adding DevExpress.Xpo.PersistentAttribute with a modified mapping: 

[C#]
...XPClassInfoci=typeInfoSource1.XPDictionary.GetClassInfo(typeof(XPObjectType));if(ci!=null){ci.RemoveAttribute(typeof(PersistentAttribute));ci.AddAttribute(newPersistentAttribute("Service_XPObjectType1"));}...

5. Domain Components (DC) cannot be used with this approach, because the XpoTypeInfoSource constructor expects a list of entity types as a parameter, which is not known at this moment. You cannot call the RegisterEntity/GenerateEntities methods of the XafTypesInfo class to obtain this list either, because in this case the types will be registered for all XpoTypeInfoSource objects within the application.



See also:
How to prevent altering the legacy database schema when creating an XAF application

How to programmatically filter report data at the data source level using query parameters

$
0
0
This example illustrates how to programmatically filter report data at the data source level using a query parameter as a filtering criterion. In this example, the query parameter has the Expression type, which allows for the use of an expression to dynamically calculate the parameter's value (e.g., to map the query parameter to the value of a report parameter).

ASPxScheduler / ASPxGridView - How to drag a row from the grid and create an appointment based on its values

$
0
0

This example demonstrates how to create an appointment based on dragged row values of ASPxGridView.

 

See Also:

How to drop an appointment from ASPxScheduler to an external control

Question Comments

Added By: Marc Michaels at: 2/14/2013 11:18:20 AM    

Your example contains a grid with a date column already provided. What if you don't HAVE a date. That's the purpose of the drag and drop. I have a grid with a list of jobs. I want to drag the job over the scheduler and have THAT determine the date.

Added By: Arulkannan K. at: 6/3/2013 5:01:00 AM    

I tried the sample given, But I got below error :"The attempt to attach to the database failed with the following information:
The user instance login flag is not supported on this version of SQL Server. The connection will be closed."

Added By: Suman Ganguly at: 6/3/2013 7:22:41 AM    

Hi
How to drag multiple row(by pressing Ctrl key to select multiple row) from ASPxGridView and create an appointment based on its values
Thanks
Suman

Added By: GÜNAY AKIN at: 11/1/2013 3:24:21 PM    

The appointment has been deleted by another user.Show detail info

How to search for objects by using all the properties or by using more complex criteria

$
0
0

This example provides a possible workaround for the Filtering - Support searching objects by a string through all the properties (or a set of properties) or by more complex criteria suggestion.
The Dennis.Search.Win module, shown in the example, provides API to create a non-persistent object that can be used to search by properties of a business class. Such a non-persistent search-object should implement the ISearchObject contract. By default, it's supported by the abstract and generic SearchObjectBase class in the module. Search-objects are shown in a Detail View with the help of the SearchObjectViewController. To compose a search criteria, a specific SearchObjectPropertyEditor is used (it contains the Search and Clear buttons).
An example use of the implemented module is illustrated in the WinSolution.Module.Win module. There is a ProductSearchObject class that is inherited from the base SearchObjectBase class. If necessary, you can create several search objects for one business class. In UI, all search objects will be listed in a drop-down list in the toolbar of a View of your business class. Download and run the attached example to see how this works in action.
(Take special note of the SearchObjectBase class implementation, because it asynchronously loads search results of a specific type from the data store into the Search Results nested List View.)

Note that if you are implementing this functionality in ASP.NET, it is necessary to set the WebApplication.CollectionsEditMode property to Edit. Otherwise, the search results will not be displayed.

 

See Also:
How to allow users to create filter via the criteria editor before previewing a report
How to use Criteria Property Editors

Question Comments

Added By: Taradanov at: 6/17/2012 8:28:29 AM    

Can you provide Web editor for this example, please?

Added By: Gavin Lipeng Ma at: 3/20/2013 7:50:39 PM    

Also need a web solution.Could you please provide a web solution for this ?

Added By: kenngo at: 5/30/2014 10:49:42 PM    

The SearchObjectBase[Product]_SearchResults_ListView in the Model Editor is autogenerated? How is the search result link to this view?

Added By: Dennis (DevExpress Support) at: 6/2/2014 2:34:35 AM    @kenngo: Yes, it is auto-generated by XAF. This is a nested ListView node, which corresponds to the SearchResults collection property of the SearchObjectBase class, which is used to display results in the UI.Added By: PTLab at: 1/29/2015 11:04:01 PM    

Do you have a plan to upgrade example to 14.2? Or can you explain how I can do it myself?
Thank you.

Added By: Dennis (DevExpress Support) at: 1/30/2015 12:21:04 PM    

@PTLab: Yes, we plan to upgrade it and provide the Web version, although I cannot promise any time frame. For now, I suggest you follow the upgrade instructions General Information > Installation > Upgrade Notes

How to customize the popup-menu of the End-User Designer

$
0
0

This sample illustrates how you can customize the popup-menu that is shown by the right-click onto the Design panel of the Report Designer.
In particular, it illustrates the process of adding the option of showing and hiding the Designer grid.

Question Comments

Added By: Marco Zierl 1 at: 5/21/2013 3:13:23 AM    

Hi,

I want to use this approach to remove the "Edit Parameters ..." command from the pop-up menu in the field list. What I came up with looks like this:

public void ProcessMenuItems(MenuKind menuKind, MenuItemDescriptionCollection items)
{
            if (menuKind == MenuKind.FieldList)
            {
                CommandID removeCommand = null;
                foreach (var item in items)
                {
                    if (item.CommandID != null && item.CommandID.ID == 6) removeCommand = item.CommandID;
                }
                if (removeCommand != null) items.Remove(removeCommand);
            }

}

Obviously, hard-coding the command ID (6) is not a good solution, but I could not find the corresponding Enum value. Can you help me here?

Marco

Added By: Uwe Philipps at: 10/1/2013 3:33:28 AM    

When using this example I only see the custom menu items on the first time the designer is shown.
When opening the designer again, ProcessMenuItems() is not called and the custom menu items are not shown.

I'm using Visual Studio 2010 and DevExpress Reporting V13.1.7

ASPxGridView - How to hide a grid column on the client side without making a round-trip to the server

$
0
0

This example demonstrates how to hide a grid column on the client side without making a round-trip to the server.


To accomplish this task, apply a dummy CSS class ('unitPriceColumn') to all column cells (header, data, edit, footer, group footer, and filter cells) in markup. Then, to show/hide these cells, just specify their 'display' style. Set it to the 'none' value to hide cells and to the 'table-cell' value to show cells. To specify a cell display style, I used a jQuerry CSS selector (using the 'unitPriceColumn' CSS class).

Question Comments

Added By: marc parthoens at: 8/25/2014 4:20:36 AM    

Can you show how I can get the value/text of a hidden column SERVER side.
Thanks

Added By: Mike (DevExpress Support) at: 8/25/2014 4:23:38 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T143607: ASPxGridView - Get Hidden Column Value on Server Side. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Daniel Kaminski at: 11/21/2014 11:04:53 AM    

I am duplicating this code in my project but I am getting this error http://screencast.com/t/NYB5i8prBLsu
Do you have any ideas what I need to do to fix it?

Thanks,
Daniel

Added By: Marion (DevExpress Support) at: 11/23/2014 10:44:37 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T177485: ASPxGridView - How to hide a grid column on the client side without making a round-trip to the server. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Focoenobra Ltda at: 11/25/2014 8:25:04 AM    

Greetings:
I'm working with this example, but with a Grid which contains a GridViewBandColumn,, fixed column and a horizontal scroll. The columns hide correctly, but when I move the scroll, the columns are visible again.
Can you help me with this issue?

Added By: Gosha (DevExpress Support) at: 11/25/2014 12:36:18 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T178629: How to hide a grid column on the client side without making a round-trip to the server. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: David Buitenveld 1 at: 1/31/2015 12:47:34 PM    

Hi, I am trying to implement this strategy in a project and it works as expected. But when I click the New link to add a row (grid goes into inline edit mode), the hidden column reappears. Any idea what I might have missed? I note that the grid's Init and EndCallback functions never seem to get called..

thanks -

David

How to implement CRUD operations when Entity Framework 5 is used

$
0
0

This example illustrates how to implement CRUD operations with XtraGrid and EF 5. To get a possibility to commit changes it is necessary to store DbContext instance that is used to get the grid's data source. Than when necessary, you can commit changes to the data base using the DbContext.SaveChanges method 

Question Comments

Added By: Hassan Gulzar at: 2/1/2015 5:26:37 AM    

I'm having issues with this approach. I have a DirType Entity that has many DirParam Entities each. If I bind to grid as mentioned below, I get the desired drilling but in the child view, If I enter a value for any cell and move to another cell, the value disappears. This is not happening on main view but sub views only.

A master-detail grid with Entity Framework objects

$
0
0

Starting with version 2012 vol 1, it is possible to enable the master-detail feature for collection properties generated by Entity Framework. See the Use Master-detail views with generic collections of type IList<T> and IEnumerable thread for details.

This example demonstrates how to bind related entities to the XtraGrid and display them in master-detail views.

See also:How to display Entity Framework objects in a grid within master-detail mode when entities have many-to-many relationship and a linked table is included to an entity model

Question Comments

Added By: Josh Soriano at: 8/16/2013 5:53:31 PM    

my problem is im using EF5 which preferred using DbSet instead of ObjectQuery, and how can i add a row in child grid...

Added By: Hassan Gulzar at: 2/1/2015 5:30:13 AM    

Same issue here as Josh said above. EF5 and onwards, the line gridControl1.DataSource = new BindingSource(customersQuery, ""); becomes invalid as customersQuery needs to have a .ToList() and that defeats the purpose because 1) I cannot have the CRUD ops auto reflect on the context 2) I cannot have one save button to submit all the changes.

GridView - Advanced Master-Detail View

$
0
0
This example illustrates the layout demonstrated in the  Advanced Master-Detail View  demo for MVC. 
Note that data modifications aren't allowed in the online demo. You can check how CRUD operations are implemented after downloading this example and  uncommenting lines related to command column settings.

How to prevent certain GridControl's properties from being serialized

$
0
0

This example demonstrates how to exclude specific properties from serialization. To accomplish this task, handle the DXSerializer.AllowProperty event for an object whose property shouldn't be serialized. In this event handler, set AllowPropertyEventArgs.Allow to 'False' to prohibit property serialization. 
In this particular example, the GridColumn.ActualWidth property has been excluded. Please note that since GridColumn is not a UIElement descendant, it's necessary to use the GridColumn.AddHandler method instead of DXSerializer.AddAllowPropertyHandler to subscribe to the event.
If it's necessary to handle this event for all columns in GridControl, you can create a GridControl descendant and override the OnDeserializeAllowProperty method:


[C#]
publicclassGridControlEx:GridControl{protectedoverrideboolOnDeserializeAllowProperty(AllowPropertyEventArgse){if(e.DependencyProperty==GridColumn.ActualWidthProperty)returnfalse;returnbase.OnDeserializeAllowProperty(e);}}

Outlook Inspired Demo Application Created Using Instant Layout Assistant

Hybrid UI Demo Application Created Using Instant Layout Assistant

Lesson 1 - Creating a Simple WinForms MVPVM Applicaiton

$
0
0
This example demonstrates how to build a simple WinForms application that follows the MVPVM pattern.

>> Lesson 1 - Create a Simple MVPVM Application (Step-by-step description)
Lesson 2 - Commands. Presenter. (Step-by-step description) (Example)
Lesson 3 - Interaction Between Views. Services. (Step-by-step description) (Example)
Lesson 4 - Navigation in MVPVM Applications (Step-by-step description) (Example)
Lesson 5 - Advanced MVPVM Application (Step-by-step description) (Example)
Lesson 6 - Multi-level navigation in MVPVM applications (Step-by-step description) (Example)
Question Comments

Added By: Pavlov Pavel at: 9/8/2014 5:40:49 PM    

Hello!
Can you provide guide or example for integrating XPO in MVPVM application? How to add data access layer to MVPVM application? For instance in Lesson 1 used object Task - POCO class, but how to use Task as XPObject?

Added By: Svetlana (DevExpress Support) at: 9/9/2014 6:50:30 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: How to implement MVPVM with XPO . This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Jason Lee 21 at: 2/2/2015 7:30:41 PM    

Which Visual Studio Version is compatible with this example?

Added By: Alexey Z (DevExpress Support) at: 2/2/2015 11:59:32 PM    

Hello,

This example is compatible with the MS Visual Studio version 2012 and higher. I.e., with an IDE which supports the .NET Framework version 4.5. I have added this information to the corresponding field in the example's profile.

How to show custom forms and controls in XAF (Example)

$
0
0

This example implements the following scenarios when an end-user clicks on a custom item in the navigation control:

- a custom non-XAF form is opened as a result;

- a standard XAF View containing a custom user control is opened as a result.


Both custom forms and user controls display persistent data from the XAF application database. For that purpose, this example solution provides a set of reusable elements (custom ViewItem and Application Model extensions) organized in a way that you can once implement them in an XAF module and reuse to display custom user controls in various forms.


Take special note that if you do not require a complex and reusable solution for this task, it is recommended to use a much simpler and built-in XAF solution - ControlDetailItem placed within a DashboardView. This item can be added and customized as described at eXpressApp Framework > Task-Based Help > How to: Create a Custom Control Detail Item.
See also the Using a Control that is not Integrated by Default article for other integration options.

If this is not your case, proceed to the instructions below:

1.
Define a base structure of the navigation control in your XAF application, as shown in the E911.Module\Model.DesignedDiffs.xafml file.

You can simply copy and paste the contents of the NavigationItems element into the corresponding file (pre-opened via the text editor) of your platform-agnostic module.

The same customizations can be achieved via the Model Editor visually.
Take special note that you can set the View parameter to any View from the list, e.g. AboutInfo_DetailView, BaseObject_ListView, etc.

This navigation structure will be further customized in the WinForms and ASP.NET executable projects later.


2. Intercept events of the navigation control to display a custom form when a custom navigation item is clicked.

To do this, implement a WindowController into your platform-agnostic module and handle events of the ShowNavigationItemController class as per the E911.Module\Controllers\ShowCustomFormWindowController.xx file. This controller will be abstract and be overridden in WinForms and ASP.NET modules.


3. Declare a custom ViewItem class that is supposed to host a custom user control in the standard XAF View. To do this, implement a custom ViewItem descendant and related types in the platform-agnostic module as shown in the E911.Module\Editors\CustomUserControlViewItem.xx file.

This ViewItem will also be abstract and platform-agnostic as it will not create platform-dependent controls, and will just provide a common customization code for both platforms. For instance, the OnControlCreated method will be overridden to bind the created control to data. To access persistent data from the database used by an XAF application, the ViewItem will implement the IComplexViewItem interface that consists of a single Setup method, receiving the IObjectSpace and XafApplication objects as parameters.

To unify our data binding code for both platforms, the IXpoSessionAwareControl interface and an auxiliary XpoSessionAwareControlInitializer class are introduced.

The interface provides a single UpdateDataSource method that is implemented by custom forms and user controls to bind them to data received by means of XPO.

You can use a similar mechanism and modify these auxiliary types to pass other custom data into your custom forms and controls.


4. Define a base structure of the standard XAF View with a custom ViewItem as shown in the E911.Module\Model.DesignedDiffs.xafml file.

You can simply copy and paste the contents of the Views element into the corresponding file (pre-opened via the text editor) of your platform-agnostic module.


5. Create custom forms and user controls in WinForms and ASP.NET executable projects analogous with what is shown in the example. The easiest way to do this is to copy the contents of the E911.Win\Controls and E911.Web\Controls folders and then include the necessary files into your solution. Take special note that these custom forms and controls implement the IXpoSessionAwareControl interface to automatically receive persistent data and other parameters when they are created.


6. Implement platform-dependent behavior to open and customize custom forms and controls. To do this, copy the following files into your WinForms and ASP.NET module projects:

WinForms:

E911.Module.Win\Controllers\WinShowCustomFormWindowController.xx - contains an WinForms version of the WindowController, which is inherited from the platform-agnostic

E911.Module.Win\Editors\WinCustomUserControlViewItem.xx - contains an WinForms version of the ViewItem, which is inherited from the platform-agnostic one;

E911.Module.Win\WinModuleEx.xx - contains a registration code for WinForms version of the ViewItem;


ASP.NET:

E911.Module.Web\Editors\WebCustomUserControlViewItem.xx - contains an ASP.NET version of the ViewItem, which is inherited from the platform-agnostic one;

E911.Module.Web\WebModuleEx.xx - contains a registration code for ASP.NET version of the ViewItem;

E911.Module.Web\Controllers\WebShowCustomFormWindowController.xx - contains an ASP.NET version of the WindowController, which is inherited from the platform-agnostic one;


These platform-dependent versions of the WindowController and ViewItem are required to implement the creation and display of custom forms and controls using the means specific for each platform. They are also designed to provide the capability to be able to set custom forms and control settings via the Model Editor. For that purpose, custom Application Model extensions are implemented for the Navigation Item and View Item model elements.


7. Set the custom forms and controls settings for each platform.

To do this, copy the contents of the E911.Win\Model.xafml and E911.Web\Model.xafml files into the Model.xafml file in the executable WinForms and ASP.NET projects:

WinForms:

ASP.NET:

 

IMPORTANT NOTES

1. It is also possible to mix the traditional and XAF development approaches (consult our Support Team if you are not sure how to integrate your standard non-XAF solution into XAF), because an XAF application is a regular .NET application built of reusable blocks like View, ViewItem, Property and List Editors, etc. that eventually create and customize platform-dependent controls exactly the same way you do this without XAF. So, using XAF does not mean something absolutely new and allows you to reuse your existing development skills and practices. Of course, it is possible to create your own reusable blocks if the standard ones do not meet your needs. For instance, the example of a custom View class designed to show a custom form can be found on CodeProject here.


2. This solution contains some generic code (e.g., base WindowController and ViewItem) that is mainly required because our XAF application is for both Windows and the Web. You may avoid this generic code and make a simpler implementation if you are developing for only one platform.


3. You can display custom forms not only when interacting with the navigation control, but from any other place. To do this, intercept the events of a required entity, e.g., an XAF Controller, Action or a View. Refer to the product documentation or consult with our Support Team in case of any difficulties.


4. By default controls layout and user customizations are preserved only for built-in XAF ListEditors, because they have special code for that. If you embed a custom user control into XAF, you need to preserve its settings yourself as well, exactly like you would do when implementing this task in the "old way" in a non-XAF application. Refer to the control's documentation to learn more on how to accomplish this task.

Feel free to contact the respective product team if you experience any difficulties customizing this control.

See also:
How to show custom forms and controls in XAF
How to create controls dynamically
How much of XAF's default UI is customizable.
How to Show a Window via an Action
How to: Display a List of Non-Persistent Objects
How to: Display a Non-Persistent Object's Detail View from the Navigation
ShowNavigationItemController.CustomShowNavigationItem Event
XafApplication.CustomProcessShortcut Event

Question Comments

Added By: kenngo at: 11/6/2012 2:24:10 AM    

Hi, I would like the custom from to be tabbedMDI, how to set this in the controller class?

Added By: Dennis (DevExpress Support) at: 2/1/2013 6:12:45 AM    

@Ngo Ken Hui:
Refer to the Q391718 ticket that describes a possible solution.

Added By: Alan mahone at: 4/26/2013 8:39:40 AM    

i have a problem in CustomUserControlViewItem.cs file
 in line "new XpoSessionAwareControlInitializer(Control as IXpoSessionAwareControl, theObjectSpace);"
the Control is converted to null

Added By: Dennis (DevExpress Support) at: 4/26/2013 8:43:18 AM    

Please submit a new ticket and attach your problematic project there:
http://www.devexpress.com/Support/Center/Question/Create
We will be glad to help you.

Added By: Andrew Bingham 2 at: 6/5/2013 10:11:58 AM    

The downloaded solution states it is for " v13.1".

The latest version I am aware of is 12.2?

Added By: Carl Howarth 1 at: 10/11/2013 4:00:36 AM    

Just in case anyony else hits the issue where the model.CustomControlTypeName is null; there are some additional model settings that are not included in the example code below (but are in the actual download).

Have a look at the XML for the E911.Module.Win/Web Model.xafml. You will notice that there are settings within these files that are not detailed below (it may be obvious to some based on the article but I missed it and it cost me the best part of a day).

Win version:
<Application>
  <NavigationItems>
    <Items>
      <Item Id="Default">
        <Items>
          <Item Id="CustomForm" CustomFormTypeName="E911.Module.Win.Controls.WinCustomForm" />
        </Items>
      </Item>
    </Items>
  </NavigationItems>
  <Views>
    <DashboardView Id="StandardFormWithCustomUserControl">
      <Items>
        <CustomUserControlViewItem Id="CustomUserControlViewItem" CustomControlTypeName="E911.Module.Win.Controls.WinCustomUserControl" />
      </Items>
    </DashboardView>
  </Views>
</Application>

Web version:
<Application>
  <NavigationItems>
    <Items>
      <Item Id="Default">
        <Items>
          <Item Id="CustomForm" CustomFormPath="Controls/WebCustomForm.aspx" />
        </Items>
      </Item>
    </Items>
  </NavigationItems>
  <Views>
    <DashboardView Id="StandardFormWithCustomUserControl">
      <Items>
        <CustomUserControlViewItem Id="CustomUserControlViewItem" CustomControlPath="Controls/WebCustomUserControl.ascx" />
      </Items>
    </DashboardView>
  </Views>
</Application>

Hope this helps.

Cheers

Carl

Added By: Daniele M at: 2/3/2015 1:43:31 AM    

is it possible to call this windows by action and pass it an object id?
if yes, how can I do?

Added By: Dennis (DevExpress Support) at: 2/3/2015 1:54:50 AM    @Deniele: Sure, that is possible. Check out the following product documentation to learn more on how to implement these tasks:
eXpressApp Framework > Task-Based Help > How to: Access Objects Selected in the Current View
eXpressApp Framework > Concepts > Extend Functionality > Show a Window via an Action
View.Tag Property
Please create a separate ticket in the Support Center and attach your test project if you experience any implementation difficulties.
Viewing all 7205 articles
Browse latest View live


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