relaycommand

MVVMLight CanExecute not working until window click

放肆的年华 提交于 2021-02-08 06:10:08
问题 Quick note so I do not waste anyone's time. When installing MVVMLight from nuget I eventually get an error null : The term 'null' is not recognized as the name of a cmdlet, function, script file, or operable program . MVVMLight seems to work fine despite this except the issue that will be described below, but I wanted to mention this just in case. The Problem I am experiencing an issue with buttons not re-enabling after command execution completes. It seems they sometimes work if the

MVVMLight CanExecute not working until window click

橙三吉。 提交于 2021-02-08 06:06:14
问题 Quick note so I do not waste anyone's time. When installing MVVMLight from nuget I eventually get an error null : The term 'null' is not recognized as the name of a cmdlet, function, script file, or operable program . MVVMLight seems to work fine despite this except the issue that will be described below, but I wanted to mention this just in case. The Problem I am experiencing an issue with buttons not re-enabling after command execution completes. It seems they sometimes work if the

How should `ICommand.CanExecuteChanged` be implemented? [closed]

谁说我不能喝 提交于 2021-02-07 14:13:19
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 days ago . Improve this question Background While looking at Josh Smith's article about CommandGroup , I noticed that there are a number of comments on the Internet about how to implement ICommand.CanExecuteChanged . A similar question was posted here on StackOverflow, but I don't feel like

How should `ICommand.CanExecuteChanged` be implemented? [closed]

若如初见. 提交于 2021-02-07 14:04:17
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 days ago . Improve this question Background While looking at Josh Smith's article about CommandGroup , I noticed that there are a number of comments on the Internet about how to implement ICommand.CanExecuteChanged . A similar question was posted here on StackOverflow, but I don't feel like

Using IMultiValueConverter to pass multiple CommandParameters to viewModel

萝らか妹 提交于 2021-02-07 12:35:30
问题 I have the following code: <DataGridTemplateColumn Header="Security"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Name="Security" Content="{Binding Path=totalSecurities}" Command="{Binding Source={StaticResource viewModel}, Path=filterGridCommand}"> <Button.CommandParameter> <MultiBinding Converter="{StaticResource PassThroughConverter}"> <Binding Path="sector"/> <Binding ElementName="Security" Path="Name"/> </MultiBinding> </Button.CommandParameter> </Button> </DataTemplate>

RelayCommand with Argument throwing MethodAccessException

谁说胖子不能爱 提交于 2020-01-14 13:35:12
问题 I am creating an application using .Net and MVVM Light and I am having some trouble for RelayCommands. I'm trying to create a RelayCommand which takes in a single argument and passes it to a function within the same ViewModel. However everytime I try and do this I keep getting the following exception: A first chance exception of type 'System.MethodAccessException' occurred in mscorlib.dll My code is below. XAML <TextBlock Style="{StaticResource QueryFormTab}" > <Hyperlink Command="{Binding

RelayCommand lambda syntax problem

半腔热情 提交于 2020-01-06 07:45:30
问题 I am applying the MVVM pattern per Josh Smith and having difficulty. I've been researching the problem here and can't seem to get the syntax quite right. The code below looks to me like it follows the required syntax, but Visual Studio reports error "Delegate 'System.Action' does not take '2' arguments" on the line indicated. Can someone see where I am making a mistake? Thanks! +tom RelayCommand _relayCommand_MoveUp; public ICommand RelayCommand_MoveUp { get { if (_relayCommand_MoveUp == null

RelayCommand lambda syntax problem

情到浓时终转凉″ 提交于 2020-01-06 07:44:08
问题 I am applying the MVVM pattern per Josh Smith and having difficulty. I've been researching the problem here and can't seem to get the syntax quite right. The code below looks to me like it follows the required syntax, but Visual Studio reports error "Delegate 'System.Action' does not take '2' arguments" on the line indicated. Can someone see where I am making a mistake? Thanks! +tom RelayCommand _relayCommand_MoveUp; public ICommand RelayCommand_MoveUp { get { if (_relayCommand_MoveUp == null

.NET delegate equality?

↘锁芯ラ 提交于 2020-01-03 02:57:07
问题 I think this is the question, anyway. I am using a RelayCommand, which decorates an ICommand with two delegates. One is Predicate for the _canExecute and the other is Action for the _execute method. ---Background motivation -- The motivation has to do with unit testing ViewModels for a WPF presentation. A frequent pattern is that I have one ViewModel that has an ObservableCollection, and I want a unit test to prove the data in that collection is what I expect given some source data (which

Why use a RelayCommand or DelegateCommand instead of just implementing ICommand?

不羁的心 提交于 2019-12-30 06:27:13
问题 I'm just learning about MVVM in WPF, I'm completely new both to WPF as to MVVM (I understand how it works, but have never used it...) Every single tutorial/article I find on the web, it uses either RelayCommand, or the DelegateCommand. In my opnion, these patterns obligues the VM to violate the SRP principle, since it will hold the command logic inside them. Why not just use a custom implementation of the ICommand interface? Just like this: Imagine that you're displaying a person and saving