This project has moved. For the latest updates, please go here.

Authorization using visibility

Jul 4, 2011 at 2:15 PM


There is a lot of plumbing implementing authorization in my application,, this is mainly around handling visibility state on buttons. If a user not are allowed to execute a command I make the button invisble.

Is there a way to extend Action command to also handle the visibility on a (for example) button?? 

Do you have any other suggestion how to manage Visibility on a Button for the purpose described above.



Jul 5, 2011 at 11:50 AM

If you bind an action command to a button using the command binding, it should work as expected. You simply use the "can execute" delegate to define the conditions for visibility and return true.

Jul 5, 2011 at 5:30 PM


I dont know if I understand you......

How do I set the Visiblity property of a button to Collapsed from the "can execute" delegate ?? 



Jul 5, 2011 at 5:45 PM

Please take a look at commands for Silverlight. Buttons support binding to commands. Commands have two methods - one that determines what to execute, and one that determines whether or not the button is enabled. If you want the "disabled" state to be collapsed, you can either bind to a property and use a value converter, or override the template for the button and change the disabled state to be collapsed.

Jul 6, 2011 at 11:58 AM