Binding styled ListBoxItem with RelayCommand?

For the Button case you should change the order of style and DataTemplate.

Up vote 0 down vote favorite share g+ share fb share tw.

As seen from below DataTemplate, I have created listview of buttons. I have specified Command and CommandParameter for this button. But when these buttons are CanExecute and Execute methods are not fired.

Now if, I place a single button on the user control and bind the command, the event fires. Why does this happen? **I have removed other setter properties and resources for keeping the codeview clean.

Secondly, how can I replace button with label and attach the ICommand directly to the ListBoxItem? Thank you in advance. :) Regards, c# wpf xaml mvvm icommand link|improve this question edited Feb 1 at 11:12 asked Feb 1 at 8:20Marshal978121 83% accept rate.

For the Button case you should change the order of style and DataTemplate- For the Label, please specify your requirement.

The order is same as described by you, but I presented here in hierarchical order for better understanding. I am changing it for avoiding misconception. – Marshal Feb 1 at 9:24.

Seems FilterCommand is losing datacontext, specify ElementName where FilterCommand has been defined(eg. Define X:Name to your window and provide it as Element ).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions