I am trying to enable and disable a button in a WPF user control (PRISM) based on user input.
In the constructor I do SubmitCommand = new DelegateCommand<object>(OnSubmit, CanSubmit); public ICommand SubmitCommand { get; private set; } private void OnSubmit(object arg) { _logger.Log(arg.ToString()); } private bool CanSubmit(object arg) { return Title.Length > 0; } private string _title=""; public string Title { get { return _title; } set { if (_title != value) { _title = value; this.RaisePropertyChanged(); } } }
I linked the SubmitCommand command in Xaml as shown below
<Button Content="Submit" Width="100" Command="{Binding Path=SubmitCommand}" CommandParameter="{Binding ElementName=TitleText, Path=Text}" />
The problem is changing the name value, the button does not turn on. Maybe I'm missing something. Thank you for your help!
source share