I have a ListBox bound to collection of items, which each defines its Command in the ViewModel.
The SelectedItem is Bound to the ViewModel of the ListBox itself with TwoWay-Binding since I need to change Selection from Code.
Short version looks like this.
<telerik:RadListBox ItemsSource="{Binding Items}"
ItemTemplate="{StaticResource ItemTemplate}"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
Command="{Binding SelectedItem.Command}"
SelectionMode="Single">
Now I've encountered the problem, that if I set SelectedItem in the ViewModel to 'null', the Item thats just been DeSelected still fires its Command one more time, which I personally would consider a bug.
Also this leads to an interesting behaviour in my app...
Someone any ideas, other than to create an event Handler for Selection changed and fire the Command from CodeBehind?
Any suggestions would be much appreciated.
Thx a bunch.