Search This Blog

Monday, March 20, 2017

More enhancements to the High DPI support in WinForms XAF applications - YOUR FEEDBACK IS NEEDED!

A month ago, I announced the High DPI support in WinForms XAF applications. 

XAF team continues making improvements in this area based on your great feedback in Support Center. We would like to share our progress with you and would greatly appreciate your leaving a comment here.

Tuesday, March 14, 2017

New ways to customize the New Action's items list in XAF v16.2.5 - YOUR FEEDBACK IS NEEDED!!!

Changing the way how the New Action's items list is populated is quite an often task. The default behavior when the current types and all its descendants are added may be inappropriate in large XAF applications with a complex business objects inheritance hierarchy.

That is why we have decided to provide more built-in modes of populating this list. The available modes are listed in the DevExpress.ExpressApp.SystemModule.NewObjectActionItemListMode enumeration.

DefaultThe current type and all of its descendant types are added.
ExcludeBaseTypeAll descendants of the current type are added. The current type itself is excluded.
LastDescendantsOnlyOnly the last types in the inheritance hierarchy of the current type are added.

XAF app performance: Reducing the number of simultaneous database connections

Multiple simultaneously opened connections consume your database server memory and thus, have negative impact on your application performance. To diagnose this situation, you can use the following SQL script:

    DB_NAME(dbid) as DBName, 
    COUNT(dbid) as NumberOfConnections,
    loginame as LoginName
    dbid > 0
    dbid, loginame

Thankfully, there is a couple of tricks to optimize your existing apps in production (they are already applied out of the box in new projects).

Friday, March 10, 2017

XAF ASP.NET WebForms v16.2.5 - Beware of the missing Edit Action after navigating to dashboard items

I want to draw your attention to the T490025: WebEditDashboardController hides the Edit Action of ListViewController and doesn't reactivate it issue, which is already fixed in XAF for v16.2.6. This thread contains a simple temporary solution if you came across a similar use scenario (hotfix installation will be available later).

Wednesday, March 8, 2017

Preview of toast notifications using a platform-agnostic method in XAF v16.2.5 - YOUR FEEDBACK IS NEEDED!!!

I am still forcing myself to go to sleep after watching an unreal football drama in Barcelona, so I am writing this short blog post at night.
Besides Visual Studio 2017 official support, XAF v16.2.5 delivers a small gem, which I cannot hide from you too long. Remember that this is an early preview of the functionality we hope to officially release by v17.1 and which is have polished in the coming 2-3 months. So, your feedback is welcome, as always!

Typical usage

Let's modify the platform-agnostic Controller from our demo (C:\Users\Public\Documents\DevExpress Demos 16.2\Components\eXpressApp Framework\SimpleProjectManager\CS\SimpleProjectManager.Module\Controllers\ProjectTaskController.cs) by adding the Application.ShowViewStrategy.ShowMessage call at the end of the Execute event handler:
            markCompletedAction.Execute += (s, e) => {
                IObjectSpace viewDataContext = View.ObjectSpace;
                foreach(ProjectTask task in e.SelectedObjects) {
                    task.EndDate = DateTime.Now;
                    task.Status = ProjectTaskStatus.Completed;
                    viewDataContext.SetModified(task); // Mark the changed object as 'dirty' (only required if data properties do not provide change notifications).
                //viewDataContext.Refresh(); // Optionally update the UI in accordance with the latest data changes.
                Application.ShowViewStrategy.ShowMessage(string.Format("{0} task(s) have been completed!", e.SelectedObjects.Count), InformationType.Success, 4000, InformationPosition.Top);
Now, let's start the Windows and Web apps, select a few uncompleted tasks in the ProjectTask ListView and execute the Done! command from the menu.

Result in the UI for various platforms

A nice notification window is managed using the dxToast widget (invoked via the  DevExpress.ui.notify method) from our DevExtreme HTML5/JavaScript library:

Tuesday, March 7, 2017

How to change an Application Model option globally or for multiple nodes

I have recently updated one of the articles on the subject in our support knowledge base and wanted to test-drive this content with you:

Since the Application Model basically represents a skeleton of the application UI, based on which visual controls for supported platforms are created at runtime, updates to various options in the source UI metadata (both at design time and runtime) can be a good and often platform-agnostic alternative to customizing underlying controls directly in Controllers or other UI entities (examples: one, two, three). The most difficult thing is to perform this update at the right moment or using the right event in the View life cycle!
Even though this may sound like a quite an advanced topic, this is one of the core concepts for our framework, which I recommend you get familiar with.

Your feedback is welcome, as always!

We also hope to use this KB as a base for future updates of the online documentation at  Concepts > Application Model  for easier discoverability, so your early feedback on the main methods I described is welcome. In particular, I would greatly appreciate your comments on whether you experienced the scenarios needed runtime Application Model updates and exactly which techniques you used (e.g., #2.1, 2.2 or all ).

How to customize the New Object Action with a single item to display a simple button instead of a dropdown in WinForms

I would like to promote an updated/simplified v16.2 solution for this task after introduction of the ActionBase > CustomizeControl event. To remind you the context, let me quote myself from the thread:

"XAF allows defining whether a SingleChoiceAction click should show a dropdown or execute an action item immediately using the ShowItemsOnClick and DefaultItemMode  properties. You can easily change these properties based on the number of the New action items. However, a triangle glyph is always shown by default. The SingleChoiceAction does not currently provide built-in means for replacing a dropdown with a simple button either. Currently, to improve user experience with such configurations, you can customize the underlying bar item in the YourSolutionName.Module.Win project.

You can use the following controller to hide a drop-down list from the NewObjectAction in case it contains only one element:

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.Win.SystemModule;
using DevExpress.XtraBars;
namespace YourSolutionName.Module.Win.Controllers {
    public class CustomizeNewActionController : WindowController {
        BarButtonItem newActionBarButtonItem;
        protected override void OnFrameAssigned() {
            WinNewObjectViewController newObjectViewController = Frame.GetController<WinNewObjectViewController>();
            SingleChoiceAction newObjectAction = newObjectViewController.NewObjectAction;
            newObjectAction.CustomizeControl += NewObjectAction_CustomizeControl;
            newObjectAction.ItemsChanged += NewObjectAction_ItemsChanged;
        private void NewObjectAction_ItemsChanged(object sender, ItemsChangedEventArgs e) {
            if(newActionBarButtonItem != null) {
                SingleChoiceAction newObjectAction = (SingleChoiceAction)sender;
                int choicesCount = newObjectAction.Items.Count;
                if(choicesCount == 1) {
                    newActionBarButtonItem.ButtonStyle = BarButtonStyle.Default;
        private void NewObjectAction_CustomizeControl(object sender, CustomizeControlEventArgs e) {
            newActionBarButtonItem = e.Control as BarButtonItem;

Here are screenshots showing the results in the application UI before and after this customization.



Also, you can use the same approach with the CloneObjectAction (it is a part of the CloneObjectViewController). Refer to the following documentation articles to learn more about this solution:
    Concepts > Extend Functionality > Built-in Controllers and Actions 
    Concepts > Extend Functionality > Customize Controllers and Actions 
    Task-Based Help > How to: Customize Action Controls
    DevExpress.XtraBars > BarButtonItem > ButtonStyle 
    DevExpress.XtraBars > BarButtonItem > ActAsDropDown 

For older versions
Check out the How to display a dropdown without a triangle glyph for a SingleChoiceAction ticket for code examples."

Thursday, March 2, 2017

Opening a navigation item in a separate web browser tab (shipping in v16.2.5)

This is another follow-up on the EnableMultipleBrowserTabsSupport feature after receiving great user feedback in this blog and via other channels (see my previous post in this regard for more details).

With the recently released XAF v16.2.5, you can open a View in a separate browser tab directly from navigation. To enable this mode, set the static NavigationActionContainer.UseLinks static property in the YourSolutionName.Web/Global.asax.xx file:

        protected void Application_Start(object sender, EventArgs e) {
            WebApplication.EnableMultipleBrowserTabsSupport = true;
            DevExpress.ExpressApp.Web.Templates.ActionContainers.NavigationActionContainer.UseLinks = true;

When this mode is enabled, an Anchor element is added into nodes of the ASPxTreeView control and into items of the ASPxNavBar control. 
This feature allows you to use generic browser techniques to work with links such as a right mouse button click for context a menu, a Control key press or a mouse wheel click (currently, the approach described in the article will not work for Macs).

ASPxGridView/ASPxGridListEditor + Server Mode + Select All = ?

I want to pay your attention to this Support Center ticket describing a recent fix for our ASPxGridListEditor, which is a wrapper over the ASPxGridView component as you know.

It is a known and pretty logical Server Mode limitation that the selection of ALL grid rows using the built-in SelectAll check box is NOT supported in this mode. That is because this particular operation defeats all server mode benefits = causes loading the whole data source into the web server memory...

Our ASPxGridListEditor did not manage the "Select All" header cell visibility prior to v16.2.4. We have corrected this mistake and now this button is hidden in server mode by default (SelectAllCheckboxMode = None). The "Select All" button is still available in Client and DataView modes only (SelectAllCheckboxMode = AllPages), though.

If you want, you can implement a custom Controller from the ticket to enable selection of all records on the currently active page only when DataAccessMode = Server (we did not follow this route in the XAF code, because it would be more confusing and even damaging for users who got used to this command). Alternatively, you can set DataAccessMode = Client/DataView  for a required ListView node using the Model Editor (of course, it you do not have many data records).

If these solutions do not help, please describe your real life use-case scenario where this SelectAll feature is needed when grid is operating in server mode. It is possible that we have an alternative and even better technical solution for you, e.g. like we did for Reinhold and his reporting scenario.

Wednesday, March 1, 2017

How to display an embedded report preview form in a Web app from a hyper link included into email

I cannot help sharing an interesting customer scenario and the solution we created for it:

This is all about Web apps and reporting, so I anticipate it can be helpful for many businesses. 

Finally, I think it will be helpful to know that a report preview can be invoked not only a popup, but also as an embedded DetailView. 
This is controlled by the ReportsAspNetModuleV2 > DesignAndPreviewDisplayMode option.

As always, I look forward to hearing your thoughts on this.