How to use

1. reference the UIAuth.Common project (or dll).
2. Implement IAuthLevelProvider class in your code.
3. Assign to AuthBehavior.AuthProvider (app.cs is good place...)
4. Mark the View model class / properties with AuthSecurityName attribute with security name for this class/properties.
5. In XAML add AuthBehavior to UI elements.
6. Optional - for special ReadOnly template add template to Resources or embedded in behavior.

Basic Reference
AuthBehavior - The behavior for the Xaml.
  • VMBounded - The View model property.
  • RemoveInvisible - If true - the UI element will remove completely from visual tree.
  • CollapseInvisible - If true - the UI element will be set to Invisible.
  • Context - Provide another context then the UI element data context.
  • DTemplate - The data template property to be replaced in readonly mode.
  • DTemplateName - The data template resource key to be set in readonly mode.
  • ReadOnlyTemplate- The Readonly data template.
  • AuthProvider - static provider for authorization level.

AuthSecurityName - The attribute to place on VM class or properties.
  • SecurityName - The security name for this element (can be shared with other elements).

AuthLevel - enum for levels - All, ReadOnly, Invisible, Unknown.

IAuthLevelProvider - The provider for authorization level base on security name.
  • GetAuthLevel - get security name (string) return AuthLevel.

In the example provided there is few properties with different security name bounded to some UI Elements (ListBox, Buttons, CheckBox)
In the running code one ListBox will disappear one will get ItemDataTemplate from resource, one from embedded.
One button will be disable from it's own bounded command and one from the VM class (implicit).

Last edited Feb 21, 2011 at 9:22 AM by Adiel, version 2


Quicoli Feb 23, 2011 at 10:40 AM 
Adiel, very interesting approach