Click here to Skip to main content
       

Silverlight / WPF

 
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 
AnswerRe: WPF - Bind IsEnabled To Method On VM PinmentorWayne Gaylard14-Jan-13 1:55 
The best way is to have a bool Property in your VM, to which you caan bind the IsEnabled property of the relevant controls like this:-
 
VM:
 
public bool CanEnableField(string Key)
{
    // if the form is in Add or Edit Mode, and the user has rights to the field, then EnableControls = true
}
 
public bool EnableControls
        {
            get
            {
                return enableControls;
            }
            set
            {
                if (enableControls != value)
                {
                    enableControls = value;
                    OnPropertyChanged("EnableControls");
                }
            }
        }
 
View:
<Label Grid.Row="2" Content="Name : " HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="2,2,2,7" />
                <TextBox Grid.Column="1" Grid.Row="2" Margin="2" IsEnabled="{Binding Path=EnableControls}" Text="{Binding Path=SelectedCustomer.Name, ValidatesOnDataErrors=True,UpdateSourceTrigger=PropertyChanged}" />
 
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman

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 

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
Web02 | 2.8.141220.1 | Last Updated 18 Dec 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid