You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. Could not make command work properly with CommandParameter.
Xaml: <TextBox Name="TxtInput" Grid.Row="0" /> <Button Grid.Row="1" Content="Click me" Command="{Binding DoSomethingCommand}" CommandParameter="{Binding Text, ElementName=TxtInput}" />
Code [RelayCommand(CanExecute = nameof(CanDoSomething))] private void DoSomething(string te) { } private bool CanDoSomething(string te) => !string.IsNullOrWhiteSpace(te);
When I type in TextBox I expect to fire CanDoSomething and enable button, but button is fired once on start and after is not notified.
Where is the problem?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello. Could not make command work properly with CommandParameter.
Xaml:
<TextBox Name="TxtInput" Grid.Row="0" /> <Button Grid.Row="1" Content="Click me" Command="{Binding DoSomethingCommand}" CommandParameter="{Binding Text, ElementName=TxtInput}" />
Code
[RelayCommand(CanExecute = nameof(CanDoSomething))] private void DoSomething(string te) { } private bool CanDoSomething(string te) => !string.IsNullOrWhiteSpace(te);
When I type in TextBox I expect to fire CanDoSomething and enable button, but button is fired once on start and after is not notified.
Where is the problem?
Beta Was this translation helpful? Give feedback.
All reactions