Silverlight RadComboBox remains open after selection

Silverlight MVVM. I have a RadCombobox and for each choice I add a new row to another datagrid. I am adding code codes to my ViewModel class and this part works. Which identifier should execute:

  • Keep the comboBox open when the control has focus so that the user can repeat the selection (I bind IsDropDownOpen to the method and setting the SelectedItem property to true, but it still closes after the selection)

  • Deselect the item selected for duplication selection. I added the SelectionChanged event and added the code to MainPage.xaml.cs, but was looking for a solution in my ViewModel.

+4
source share
1 answer

Let's say

IsDropDownOpen = {Binding IsDropDownFromViewModel} 

In addition, assuming that the recipient of IsDropDownFromViewModel covers all of your conditions so that the drop-down list is open and will always return the correct state of the drop-down list.

Now all you have to do is fire the PropertyChanged event for that property wherever / when you think the dropdown should have been open, but closed or vice versa.

Unfortunately, I did not get your exact script, but let's assume that it is (you should use a similar approach to fix any problem you have).

Example script:

When you select an item, the drop-down list closes, it must remain open

In the above case, one user selects an item, the installer for the selected binding property selectedItem should be called, so here we write the notification code

  public SelectedItemType SelectedItemInViewModel { get{ return _selectedItemVM; }, set{ _selectedItemVM=value; NotifyPropertyChanged("IsDropDownFromViewModel"); } } 

What is it, it tells the radComboBox IsDropDownOpen property to re IsDropDownOpen evaluate its required expression in RHS and get its new value

I hope you get the gist of the approach if you do not leave a comment.

+1
source

All Articles