Search This Blog

Thursday, October 19, 2017

How to group validation rules by a business type in Model Editor

If you want the same UI as in the screenshot below:


implement a few code lines in YourSolutionName.Module/Module.cs file, as follows:

using DevExpress.ExpressApp.ModelEditor;
using DevExpress.ExpressApp.Validation;
using DevExpress.ExpressApp.Model;

namespace MainDemo.Module {
    public sealed partial class MainDemoModule : ModuleBase {
        public MainDemoModule() {
            InitializeComponent();
            ModelEditorGroupingHelper.Instance.RegisterNodeGroupPathDelegate(
            typeof(IModelValidationRules), node => DefaultGroupPathCalculator("TargetType.Name", node));
        }
        public string[] DefaultGroupPathCalculator(string propertyName, IModelNode modelNode) {
            string groupName = "";
            object propertyValue = ModelEditorGroupingHelper.Instance.GetPropertyValue(propertyName, modelNode);
            if(propertyValue != null) {
                groupName = propertyValue.ToString();
            }
            return ModelEditorGroupingHelper.Instance.SplitGroupPath(groupName, modelNode);
        }
        //...
    }
}

This is just one example of the Model Editor nodes grouping customizations that you can achieve with the ModelEditorGroupingHelper  API.

I remember our loyal customer Mario Blataric doing magic using this helper for his specific project needs (multi-level grouping of Actions by Controllers and their namespaces/functional blocks). If you have similar needs in your project, feel free to contact our support team so we can help you make your life easier.

Tuesday, October 10, 2017

ImmediatePostData attribute support in XAF Mobile v17.1.7

I am happy to inform you that starting with version 17.1.7, XAF Mobile (CTP) supports ImmediatePostDataAttribute. You can see how it works in action using our https://demos.devexpress.com/XAF/MainDemoMobile/ demo in the Payment object's View. 


You are welcome to download the latest version and test this feature in scenarios you are interested in. As usual, your feedback is greatly appreciated. Do not hesitate to submit tickets in our Support Center.

NOTE: Automatic updates will not work for non-persistent calculated reference properties due to an OData specificity.

Friday, September 15, 2017

Ways to migrate old XAF reports to the ReportsV2 module


The old Reports Module is obsolete, though it is still shipped with XAF to provide compatibility with legacy XAF applications. While we do not urge or request that our clients migrate their existing solutions to the new ReportsV2 module immediately (since the former module is valid and can be used in existing apps), we do recommend using the new Reports V2 Module  module for new projects. You can also use ReportsV2 and the previously available Reports modules within the same application if you want to maintain use of existing reports along-side of new reports generated with XAF's ReportsV2 module. 

Take special note that supporting the old module required and continues to require our resources (which are taken from new features), because dealing with the new IDEs/.NET versions is costly (not to mention changes in the underlying components). It was thus far not critical for our team to think about the removal date at this stage, but we will see how it goes in the future. So, you must definitely plan this migration for the future, but it is not that urgent. When we decide on the date with our management, we will surely communicate these plans to our customers in advance before their projects stop compiling.


To switch to the Reports V2 in your existing application, follow one of the approaches detailed below: https://www.devexpress.com/kb=T515516

FreeImages.com/Jeff Prieb

Wednesday, September 13, 2017

Simplifying the use of ASPxGridListEditor with XPO classes that have composite keys


Starting with the 17.1.4 version, you can use the built-in StructTypeConverter<T> for composite or compound key properties to enable some built-in DevExpress.Web.ASPxGridView functions in ASPxGridListEditor (e.g., inplace editing and the selection column), which would be missing without a type converter.


This converter can be applied to a struct (Structure in VB.NET) representing your complex key using the standard TypeConverterAttribute:

[TypeConverter(typeof(StructTypeConverter<CompoundKey>))]
public struct CompoundKey { ... }


You can view the full example by the documentation link above.


Despite this minor improvement making the lives of certain XAF users easier (and reducing our support costs too), I must emphasize that we do not recommend using composite keys in new apps. XPO supports such keys for legacy databases only and their use imposes some limitations on the default XAF functionality. You can learn more about this from How to create a persistent object for a database table with a compound key


FreeImages.Com/Kirill Levin

Thursday, September 7, 2017

Minor improvements to the Web editors for image and reference properties

Starting with version 17.1.6, we simplified access to the internal upload control of the ASPxImagePropertyEditor, because several users wanted to tweak it. Here is the KB Article showing how to access ASPxImagePropertyEditor's ASPxUploadControl and customize it to set the maximum file size and allowed file extensions for the uploaded images:






Starting with version 17.1.6, we added the static DefaultViewModeBehavior property and the ViewModeBehavior property to the ASPxObjectPropertyEditorBase class (the base class for ASPxLookupPropertyEditor and ASPxObjectPropertyEditor used for reference properties).

To globally disable or show links, we recommend using the static ASPxObjectPropertyEditorBase.DefaultViewModeBehavior property instead of the former ASPxObjectPropertyEditorBase.ShowLink property. For instance, you can do this in the YourSolutionName.Web/Global.asax.xx or WebApplication.xx files:

static MainDemoWebApplication() {
            DevExpress.ExpressApp.Web.Editors.ASPx.ASPxObjectPropertyEditorBase.DefaultViewModeBehavior 
                = DevExpress.ExpressApp.Web.Editors.ASPx.ObjectPropertyEditorViewModeBehavior.ShowLabel;

If it is necessary to disable or show links in a specific situation, you no longer need to inherit a custom property editor from ASPxLookupPropertyEditor; just get access to the required PropertyEditor (see Access Editor Settings) and set the ViewModeBehavior property to the ShowLabel or ShowLink value. 


How to implement the CreatedBy, CreatedOn and UpdatedBy, UpdatedOn properties in a business class

I would like to promote a KB article, which may be interesting for users who are just getting started with our application framework. This information is actually not new and it was already available in the FAQ and Reference sections of our online documentation as well as the support knowledge base.


I must emphasize that there are actually many ways to implement such auditing properties, and your current code may differ from what we show. For instance, one may declare it as "internal  set {...}" or use the PersistentAlias attribute. Just do not be at all concerned. 

You are welcome to share your own implementations in post comments - maybe we can vote for the most concise and beautiful code, eh?:-P


Friday, September 1, 2017

Focusing the newly added grid column in the Column Chooser dialog of the WinForms GridListEditor

Has anybody noticed this small improvement in XAF v17.1.5 (added as per this customer request)?
If not, check out this video to see what I am referring to:



Hopefully, this will help eliminate extra time when scrolling and searching for your end-users, especially if there are many-many columns.


We've not yet enabled this by default in DetailView and look forward to hearing your thoughts on this.