Search This Blog

Monday, June 30, 2014

Using a built-in lookup editor based on values from another table for editing simple property types

This is actually a variation of a solution I described in my recent A very interesting way to update and display a persistent property via a non-persistent one post, because it is again based on a non-persistent reference property filtered using the DataSourcePropertyAttribute along with a custom data source collection.
This non-persistent reference property is represented using the standard XAF's lookup PropertyEditors, which are quite convenient for providing a user with the capability to select a single value either from a database table or from an arbitrary data source. In one turn, by adding custom logic to the getter and setter of our non-persistent calculated property, we can update the stored persistent value, which does not need to be a reference to another persistent class (table), but to any type (e.g., string or integer). This may come in handy for legacy databases when you cannot really modify the schema to provide normal associations between tables.



Let's take a look at the actual code for this solution:

Thursday, June 26, 2014

Сustomizing the number of failed login attempts before exiting the application with the enabled security system

Just wanted to inform you of another improvement, which you may find helpful.
From http://www.devexpress.com/Support/Center/Question/Details/S36898:


Implemented:
  • v2014 vol 1.5 : Official update is not yet available


Additional information:
The XafApplication class now provides the MaxLogonAttemptCount property, which is set to 3 by default. You can modify this default either in code or via the Application Designer.



I wanted to thank our customers Krzysztof and Robert for reminding us about this in the Support Center ticket. Please do not hesitate to contact us about similar gems that can improve your life as a framework developer. We are always happy to hear from you on what and how you develop, which scenarios are most important to you and what can be done to make it even better.

ViewController or Action activation for multiple Views or target object types via the TargetViewId property

I would like to highlight a small usability improvement that may help you write less and simpler code when configuring a target View for which a ViewController or an Action will be available.

Let's consider a couple scenarios where it may be helpful:
1. Your ViewController/Action should work for Views corresponding to absolutely unrelated Object1 and Object2 types (there is no inheritance between them and they are not descended from a common base class).
2. Your ViewController/Action should work for several specific Views of a certain object type, but be unavailable for other Views of the same type (e.g., be active for Object3_ListView, Object3_DetailView, but not for Object3_LookupListView and others).

Starting with version 14.1, you can implement the second scenario by setting the TargetViewId property of your ViewController or Action by providing a semicolon-separated list of Views, for which your element should be activated. Previously, you should have written the View.Id checks manually before executing your code. Please consider the following example:

Tuesday, June 3, 2014

Using a control that is not integrated by default

XAF is designed as a highly extensible and customizable framework. So, in most cases, the task of integrating a WinForms or an ASP.NET control is quite simple. You can integrate a DevExpress control that is not supported by default, a third-party control, or your own custom control. Generally, you should implement an abstract entity (ListEditor, PropertyEditor or ViewItem) that wraps the control and serves as an adapter for the XAF infrastructure. You can also customize a template and place the control in the desired location.

To help you choose an appropriate solution depending on your business scenario we have created a table that lists typical tasks and provides links to relevant examples:

https://help.devexpress.com/#Xaf/CustomDocument3610

I hope you find this new documentation helpful.


Tuesday, May 20, 2014

RE: WinForms Outlook-Style Navigation Controls (Coming soon in v14.1)

I am writing this post in response to the recent blog from our WinForms team: https://community.devexpress.com/blogs/thinking/archive/2014/05/09/winforms-outlook-style-navigation-controls-coming-soon-in-v14-1.aspx. There were a lot of comments on whether it is possible to have this feature in XAF. Well, it is possible and this integration is quite easy if you really need it. After all, an XAF app is nothing more than a standard WinForms or ASP.NET Web Forms app, which means that the same approaches can be applied to develop it. The XAF documentation describes most of the integration scenarios and our support team is also ready to help if you are in a need for something special.

Another good news is that here, it is all standard and you just need basic WinForms development skills and a minute or two to follow the How to: Customize a Windows Forms Template article from the XAF's documentation.


Caution: I was not planning on replicating Outlook 2013 by any means here, but just experimented with alternative navigation controls. I also removed the status bar, placed the navigation bar under the main view site and did not use tree-like navigation in groups on purpose, because it was not very suitable just for this simple demo app. Replicating the Office 2013 UI requires additional customizations of templates and other UI elements, and is not covered in this post.

Wednesday, May 14, 2014

A very interesting way to update and display a persistent property via a non-persistent one

Scenario:

A customer wanted to extend the User class with additional property that would store the information about the startup View for this user when it launches the app. This is very similar to the StartupNavigationItem attribute, which is present for the NavigationItems node in the application model, but with the difference that application users should be able to modify this via the standard XAF CRUD forms.

How would you normally approach this?;-)

Possible solutions

At this time, I can think of at least three good options for accomplishing this task: two platform-dependent and one platform-agnostic, which I am going to detail later in this post. In all three cases we will extend our business class with a string property that would store this startup View information (its identifier) in the database.