Scenario:
This example demonstrates how to show a custom View against a role of the currently logged user. Custom Views were created and customized through the Model Editor for each role separately. For more convenience, custom Views have a name of a role in the Id attribute. For instance: Contact_ListView_Administrators, Contact_DetailView_Administrators, Contact_ListView_Users, Contact_DetailView_Users, etc. You may consider a specific naming convention, for example, to add a role name to the end of the view name.
Implementation details:
1) There is CustomizeViewAgainstRoleMainWindowController that tracks View showing using the XafApplication.ViewCreating event and replaces the default View's Id with a custom Id found in the Application model by the role name.
1 alt)Alternatively, you can handle the XafApplication.UserDifferencesLoaded event and patch the ViewID of required navigation items under the NavigationItems node as well as the DefaultListView/DefaultDetailView attributes of the BOModel | Class nodes.
Question Comments
Added By: Serkan Dede 1 at: 1/14/2016 10:27:35 AM
Hi,
I got error in Application_ViewShowing method on line :
e.View.SetModel(modelView);
Error Message:
Cannot change property 'DefaultSorting' when the XPCollection is not in design or initialization mode.
Any idea to resolve this issue?
Added By: Dennis (DevExpress Support) at: 1/15/2016 2:02:00 AMHello Serkan,
To process your recent post more efficiently, I created a separate ticket on your behalf: T334575: The "Cannot change property 'DefaultSorting' when the XPCollection is not in design or initialization mode" error occurs when calling e.View.SetModel(modelView);. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
Hello Joel ,
I've created a separate ticket on your behalf (T370594: E274 in 15.2). It has been placed in our processing queue and will be answered shortly.