Click here to Skip to main content
       

Silverlight / WPF

 
GeneralRe: Random Image with array PinmvpDave Kreskowiak21-Jan-13 18:54 
QuestionDispatcherTimer Tick event not fired PinmemberPraveen Raghuvanshi17-Jan-13 5:54 
AnswerRe: DispatcherTimer Tick event not fired PinmemberPaulo Zemek23-Jan-13 7:28 
QuestionWhich way to load entity child collections? PinmemberUCLAdam16-Jan-13 6:11 
QuestionWPF with Web PinmemberRishabh Kumar14-Jan-13 9:42 
AnswerRe: WPF with Web PinmemberAbhishek Pant14-Jan-13 10:17 
AnswerRe: WPF with Web PinmvpAbhinav S16-Jan-13 18:20 
QuestionWPF - Bind IsEnabled To Method On VM PinmemberKevin Marois13-Jan-13 12:06 
I'm working on an WPF MVVM application. The data entry screen has to have all it's fields disabled until the user clicks "Add" or "Edit", and also the fields cannot become enabled if the user does not have rights to that field.
 
So, I would like to bind all IsEnabled properties in the XAML to a single method on the ViewModel. I would need to pass in a string value which is the 'key' of the field. Then in the VM would use the key to check the rights. The method would be something like
 
public bool CanEnableField(string Key)
{
    // if the form is in Add or Edit Mode, and the user has rights to the field, then
    // return true, else false
}
 
A converter would probably not work because that class won't know about the VM and the form's mode (Add/Edit).
 
I could bind each field's IsEnabled to individual properties on the VM and handle all this in the getter, but that would be a lot of properties in the VM.
 
Anyone have any thoughts on how to do this?
If it's not broken, fix it until it is

AnswerRe: WPF - Bind IsEnabled To Method On VM PinmentorWayne Gaylard14-Jan-13 1:55 
AnswerRe: WPF - Bind IsEnabled To Method On VM PinmemberRichard Deeming14-Jan-13 3:13 
GeneralRe: WPF - Bind IsEnabled To Method On VM PinmemberKevin Marois14-Jan-13 11:40 
GeneralRe: WPF - Bind IsEnabled To Method On VM PinmemberKevin Marois20-Jan-13 9:47 
QuestionWPF - Sync Combox [modified] PinmemberKevin Marois12-Jan-13 16:19 
AnswerRe: WPF - Sync Combox PinmemberMycroft Holmes13-Jan-13 1:50 
GeneralRe: WPF - Sync Combox PinmemberKevin Marois13-Jan-13 18:24 
GeneralRe: WPF - Sync Combox PinmemberMycroft Holmes14-Jan-13 1:11 
GeneralRe: WPF - Sync Combox PinmemberKevin Marois14-Jan-13 6:25 
GeneralRe: WPF - Sync Combox PinmemberSledgeHammer0114-Jan-13 10:34 
GeneralRe: WPF - Sync Combox PinmemberKevin Marois23-Jan-13 18:41 
QuestionStyle From Resource File Not Being Applied PinmemberKevin Marois12-Jan-13 11:20 
AnswerRe: Style From Resource File Not Being Applied PinmvpRichard MacCutchan13-Jan-13 0:44 
GeneralRe: Style From Resource File Not Being Applied PinmemberMycroft Holmes13-Jan-13 1:45 
GeneralRe: Style From Resource File Not Being Applied PinmvpRichard MacCutchan13-Jan-13 2:24 
GeneralRe: Style From Resource File Not Being Applied PinmemberKevin Marois13-Jan-13 11:58 
QuestionRoutedEvent vs AttachedEvent - Syntax difference only? Confused [modified] Pinmemberdevvvy9-Jan-13 21:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 23 Dec 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid