Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to implement a custom attribute to customize the Application Model

$
0
0

This example demonstrates how to use a custom attribute to remove properties from the DetailView.Items and ListView.Columns node. In this case, properties will be removed from the Column Chooser and Layout Customization window, and the user will be able to add them only by using the Add button, placed to these windows in Windows Forms applications.
To implement this functionality, the IModelMember interface is extended with the IRemovedFromViewInfo interface that contains a single property - IsRemovedFromViewInfo. The value of this property is calculated based on the value of the custom attribute (RemoveFromViewInfoAttribute) applied to the persistent class. This is done via the domain logic (RemovedFromViewInfoLogic). Then the IRemovedFromViewInfo.IsRemovedFromViewInfo property is used by the model nodes generator updater (ViewsNodesGeneratorUpdater) to remove certain view items and columns from detail and list views. Thus, the example demonstrates three techniques: extending the Application Model with additional properties, defining default model values via the domain logic and changing the default model via the model nodes generator updater. You can find more information about these techniques in the How to customize the Application Model from the code of the business class article.

See also:
Extend and Customize the Application Model in Code


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>