Search This Blog

Wednesday, March 30, 2016

Improving usability with regard to the ImmediatePostData functionality in Web apps

As you probably know from my recent posts, one of our team OKRs was and still is "improving developer experience when accomplishing common tasks". In this blog post, I am going to cover two more small, but important improvements in XAF v15.2.8+ that add to this larger goal:


In short, in both cases the previous custom-tailored solutions are no longer required, as the corresponding code has been moved to the standard delivery. You can test these improvements right away after installing the following hot fix build: 


I am looking forward to hearing from you once you have had an opportunity to test the latest build with your real web projects.

How to change font settings for all or individual UI elements (toolbar and context menus, property editors, etc.) per View or globally

I want to inform you of my recent updates to the corresponding Support Center article as I think it may be interesting for the XAF community.


Take special note that the current dynamic solution for WinForms may be greatly simplified in future versions (no additional BarAndDockingController customizations in the Window.TemplateChanged  event handler), because I discussed this with the leaders of our WinForms team.

Tuesday, March 29, 2016

How to change the default error icons for failed validation rules

I've just updated the corresponding Support Center ticket and want to share one more advanced example on using the built-in ImageLoader API with you. Before reading further, please learn more on this helper class from its docs or from my previous post on the same subject: 




Thursday, March 24, 2016

How to colorize (make red) the asterisk symbol accompanying captions of required fields

This is one more blog post on styling or customizing appearance of default XAF editors (check my previous article here). I will share a short tutorial on fine-tuning the new validation feature we added in v15.2: XAF - Validation Module Enhancements for Windows and the Web (Coming soon in v15.2).

In the end you should know more about the known HTML Formatting feature of our WinForms controls and also learn more about the previously unknown (probably) specificity of the standard Literal control used in ASP.NET WebForms apps for captions, which both should open new horizons for your app.

So, let me quote myself from this Support Center thread:

To accomplish this task, follow the instructions below. While the underlying implementation is different for Windows and the Web, the idea is the same - use DevExpress specialized or native HTML tags to format the label's text or required field mark text.

WinForms:
1. Invoke the Model Editor for YourSolutionName.Win/Model.XAFML file;
2. Under the Options node, set the EnableHtmlFormatting property to True;
3. Under the Options | LayoutManagerOptions node, set the RequiredFieldMark property to 
<b><color=red>*</color></b>

Note: since the layout is managed with the help of the LayoutControl, we are using the built-in HTML Text Formatting feature of our WinForms Controls for this task.  


ASP.NET:

1. Invoke the Model Editor for YourSolutionName.Web/Model.XAFML file;
2. Under the Options | LayoutManagerOptions node, set the RequiredFieldMark property to 
<b><font color="red">*</font></b>

Note:
1. since the layout item captions are rendered with the help of the standard System.Web.UI.WebControls.Literal control, according to MSDN, we can use standard HTML tags in the label's text.

2. There may be gaps between the caption and the editor under certain circumstances, so you may need to additionally adjust this distance as per this Support Center thread.

Tuesday, March 22, 2016

Web DetailView layout styling with the CustomCSSClassName attribute in the Model Editor

This small feature is available for the new XAF Web UI only, which is enabled by default in new projects starting from v15.2.7 and on. In short, the CustomCSSClassName attribute allows you to set a CSS class for a layout item or a group. Let's see how this works in practice.

For instance, to customize the color and size of the FullName view item, add the FullNameCSS CSS class in YourSolutionName.Web/Default.aspx file exactly as you would do this in a regular non-XAF ASP.NET application:
  
<!--...-->
<head runat="server">
    <title>Main Page</title>
    <meta http-equiv="Expires" content="0" />
    <style type="text/css">
        .FullNameCSS
        {
            font-size: 25px;
            color: darkblue;
        }
<!--...-->

Tuesday, March 15, 2016

Speeding the Model Editor up for large data models by disabling the Linked Nodes feature - YOUR FEEDBACK IS NEEDED!

We have recently received an inquiry from a customer who experienced low performance and intensive CPU utilization when opening the Model Editor for quite a complex project...Here I wanted to share a simple tip (+ short survey in the end!) that has helped that guy to improve the situation a lot in his particular project. To refresh your memory about 'Linked Nodes' (or Links as you see it in the Model Editor), let me quote our online documentation:

Certain nodes have a "virtual" child node named Links. Under this node, you can see nodes that contain references to the current node. The screenshot below illustrates the Department node of the IModelClass type. Within the Links node, you can see the Creatable Item for the Department object, Members of the Department type and Views designed for the Department type.



Our performance tuning tip is to disable this feature if you do not really use it or if it causes performance problems when the data model is really complex. Thus a lot of calculations are required to detect all dependencies aka linked nodes.

To apply this tip, set the static DevExpress.ExpressApp.Win.Core.ModelEditor.ExtendModelInterfaceAdapter.LinksEnabled property in the constructor of your WinForms ModuleBase descendant in the YourSolutionName.Module.Win/Module.xx file:

Thursday, March 3, 2016

How to perform CRUD operations with non-persistent objects using standard XAF forms

This post is about our putting a continuous effort into improving XAF developer usability in scenarios requiring manipulation of non-persistent objects or POCOs. Typical scenarios relying on such non-persistent classes include all sorts of confirmation dialogs, user input forms with parameters, lists with temporary data, analysis and reporting data obtained from dynamic runtime calculations, stored procedures (SP), arbitrary SQL queries or third-party services or anything that needs a standard XAF CRUD UI (and, of course, extra modules), but does not require object state to be eventually persisted to the database.

As you probably know, XAF was primarily designed for automatic UI generation tied to one of the two supported persistence layers or ORM technologies - XPO and Entity Framework. Don't get me wrong here: binding standard XAF forms to temporary non-persistent data was always possible (and there are many standard XAF pieces are implemented with it: logon, change the password, about, validation, notification dialogs, etc.), but the number of supported scenarios was quite limited previously. For instance, a year ago there was no really straightforward way of binding a non-persistent list of objects to a ListView directly. It required creating an intermediate non-persistent class holding a collection of non-persistent objects and then showing its DetailView (learn more on this former approach...).

So that is where NonPersistentObjectSpaceProvider, NonPersistentObjectSpace and its ObjectsGetting event first came to the rescue in v15.1 to simplify the lives of XAF developers (learn more...). The current v15.2 brought it to the next level by allowing standard XAF CRUD commands (the New, Delete and Save Actions) for non-persistent objects. The ModifiedObjects property of the NonPersistentObjectSpace class provides access to all created, deleted and modified objects within its scope, unless the IObjectSpace.CommitChangesIObjectSpace.Refresh or IObjectSpace.Rollback methods are called. Step-by-step instructions for implementing this functionality in your XAF v15.2.4+ project are now provided in the online product documentation:

How to: Perform CRUD Operations with Non-Persistent Objects

And here are a couple of screenshots showing what it can look like in the UI*: