WPF ListBox as RadioButtonList - mimic SelectionChanging Event via WPF validation
I am using ListBox for having RadioButtonList behaviour (that's what people recommend as there is no inherent radio button list in WPF). The listbox is bound to a ViewModel.
Now, whenever user changes the selection on listbox, I want to check whether user has some unsaved data on the part of screen and prompt accordingly (typical yes,no,cancel). If I use SelectionChanged event, the selection has already occured and hence, prompting is of no use. And ther开发者_如何学编程e doesn't seem to be any SelectionChanging event.
I am am not sure but can I mimic SelectionChanging behaviour by using WPF binding validation rules? Or should I use MouseButtonDown event? Would that lead to problems?
You don't need to put them in a listbox, the are group-able like so:
<RadioButton GroupName=“One“ IsChecked=“True“/>
Notice the GroupName, this holds the collection together, as for the rest of your question I am having a slight issue understanding what you need, sorry :(
精彩评论