Current filter:
                                You should refresh the page.
                                  • Description:
                                    I like XAF default generated UI, but is this possible to somehow invoke a custom form, which I designed in Visual Studio or add custom user controls into the default XAF forms?

                                    This article is now obsolete. Instead, refer to the eXpressApp Framework > Concepts > UI Construction > Using a Custom Control that is not Integrated by Default overview article and the following help topics in particular:
                                    eXpressApp Framework > Task-Based Help > How to: Show a Custom Data-Bound Control in an XAF View (WinForms)
                                    eXpressApp Framework > Task-Based Help > How to: Show a Custom Data-Bound Control in an XAF View (ASP.NET)
                                    Concepts > UI Construction > Views > Ways to Show a View
                                    How to: Show a Custom Windows Form
                                    How to: Show a Custom Window with an Embedded XAF View
                                    Ways to Show a Confirmation Dialog

                                    Note that XAF applications are regular .NET applications, and you can accomplish any task you can accomplish in a regular application. So, this task can be easily done in XAF too.
                                    Just design a custom form in Visual Studio, and then show it using a Controller. This KB Article shows how to invoke a custom form from the navigation control and from the toolbar, after clicking on a button.
                                    IMPORTANT NOTES
                                    1. In the majority of cases you do not need to use custom forms designed manually in Visual Studio. It can be easily done, but it is not always recommended. In most cases, it will only cause unexpected problems. Since you are working with XAF, you should always first try to use native XAF approaches.
                                    However, there is a small number of situations when it's really easier to design a custom form or a user control and then show it, for example, via an Action or embed into an existing View. Usually, these cases are all about very complex customizations of the default XAF's UI that are not supported in XAF by default. For example, complex wizard pages, customizing the ASP.NET grid control to force it to work in the master-detail mode or enabling LayoutView mode in the Windows Forms grid control (it's not yet supported in XAF by default). Take special note that it's possible to implement such tasks in XAF, but it will take more time and efforts to achieve this by using "pure" XAF's approaches (for example, implementing a general solution via a custom ListEditor) will be greater than by designing a simple form with a grid bound to a predefined XPCollection, especially taking into account that usually you need such specific customizations only in a couple of places within your application.
                                    2. In 99% of all cases this task can be solved by showing standard XAF views as described in the following Knowledge Base articles and Code Central examples:
                                                How to show a window ( View ) representing data in XAF
                                                Show a Window via an Action
                                                OBSOLETE - How to show several Views side-by-side in the application window
                                                How to show custom forms and controls in XAF (Example)
                                                How to: Display a List of Non-Persistent Objects
                                    3. If you really want to use a custom form manually designed in Visual Studio in our framework, the chances are 99% that you are going to do something wrong, due to point ?1 in these notes.
                                    4. If, after reading the previous point you are not sure of the best way to accomplish your task, please contact our Support Team, and describe your business scenario. We will be glad to suggest the best way of solving your task in XAF.
                                    5. From my XAF experience there are about 1% of cases that need to use really custom non-XAF forms. Usually, this happens if your client has some specific requirements regarding the application's look and feel. Another case can be when you have a legacy Windows Forms application with prepared forms, and you want to inject them in XAF "as is", so you don't reinvent the corresponding business logic in them, using normal XAF methods.
                                    Here, I will try to summarize the technics that can be used in XAF to show various windows with data, controls, etc.
                                    1. Showing a standard window containing only data fields.
                                    To accomplish this task you should use a Controller and an Action, which will trigger showing the window. For instance, this help topic illustrates this approach very well: Show a Window via an Action. You can show either a standard detail or a list view here. If this window should not be linked with a table in your database, you can create a non-persistent class, and then add required data fields to it, and show it the same way.
                                    For example, this is a UIContainerObject class in the WinWebSolution.Module of the attached example. The ShowCustomFormWindowController class in this module shows how to create a window for this class. These methods are already described in the articles I pointed out above.
                                    2. Showing a standard window containing custom user controls and other customizations.
                                    If your window will contain data from your business classes and represented in non-standard controls, you should also use the approach described previously, but only customize the required data-bound controls and add necessary unbound-controls, either via controllers or via the application model.
                                    Here, briefly, I am talking about using various custom ListEditors, PropertyEditors, DetailViewItems, layout customizations, etc. The following article UI Construction seems to cover all the possible technics that can be used to fully change the look and feel of standard windows.
                                    For instance, here I have implemented two custom DetailViewItem classes: WinUIContainerDetailViewItem and WebUIContainerDetailViewItem, and then customized the UIContainerObject_DetailView in the Model Editor, to add this custom DetailViewItem in the layout.
                                    3. Showing a fully custom window.
                                    As I have already said, this is not the recommended approach, but you can use it if you really need to. To accomplish this task, use the same approaches that you used in non-XAF applications. Of course, these approaches depend on the platform they are targeted to, for instance, if thaere are custom controls libraries where custom forms and controls reside. In my example, the WinShowCustomFormWindowController and WebShowCustomFormWindowController classes demonstrate how to invoke these forms from an XAF application.
                                    The concept is the same: a Controller + an Action that triggers showing your form.
                                    To effectively use this approach, you should have significant experience in creating and designing custom user controls and forms for both platforms. You should also know the corresponding platform specifics and always be aware of what you do with custom controls, and why and the reason they work this way. This approach is also not recommended, because it has a low-level of abstraction, as well as being platform-dependant.
                                    IMPORTANT NOTE
                                    In the example in this KB Article, there are several custom user controls. To learn more on creating user controls and their custom specifics, refer to the corresponding MSDN documentation may be needed.
                                    Below are some articles that address problems that many of our customers experience with custom user controls:
                                    ASP.NET page life cycle
                                    HOW TO: Dynamically Create Controls in ASP.NET with Visual Basic .NET
                                    An Extensive Examination of User Controls
                                    Building Re-Usable ASP.NET User Control and Page Libraries with Visual Studio 2005
                                    This note mostly concerns creating custom WebUserControls and reusing them in XAF ASP.NET applications. If you have created a custom WebUserControl, and in XAF ASP.NET application it doesn't function as you expect, most likely it is caused by a limitation of ASP.NET itself, rather than by a bug in XAF. The fact is that the XAF application is a regular .NET application and it does support everything that the .NET Framework supports. It doesn't impose constraints on your custom control. For instance, if you use a custom control for a custom DetailViewItem, XAF simply instantiates this control and nothing more. So, before submitting a bug on an XAF product itself, please ensure that the issue is really related to XAF, and everything works fine if it is isolated within a regular non-XAF application for the same scenario (it's important that controls were created and placed within a parent container dynamically), and not caused by the platform (ASP.NET or Windows Forms) itself. The links above and possibly other articles in MSDN and Google will be helpful.
                                    See Also:
                                    How much of XAF's default UI is customizable.
                                    Extend Functionality
                                    Controller Class
                                    Built-in Controllers and Actions
                                    ShowNavigationItemController.CustomShowNavigationItem Event
                                    XafApplication.CustomProcessShortcut Event
                                    How to: Display a List of Non-Persistent Objects
                                    OBSOLETE - How to Add a Button to a Form ( Windows Forms )
                                    OBSOLETE - How to Add a Button to a Form ( Web Forms )
                                    How to Customize a Template

                                0 Solutions

                                Creation Date Importance Sort by