Setting the selecteditem on the combobox?

Topics: Conventions
Feb 17, 2012 at 1:41 PM
Edited Feb 17, 2012 at 1:42 PM
I have not been able to figure out how to set the value of my combobox... It 
populates correctly and can get the selectedBreed, but when it comes time to 
set what would be the selecteditem... thats where Im not sure how that is accomplished. 
<dxe:ComboBoxEdit x:Name="Breeds"
		  IsTextEditable="False" />
private IObservableCollection<Breed> _breeds; 
public IObservableCollection<Breed> Breeds { 
     get { return _breeds; } 
     set { _breeds = value; NotifyOfPropertyChange(() => Breeds); } } 
private Breed _selectedBreed; 
public Breed SelectedBreed { 
     get { return _selectedBreed; } 
     set { 
             if (_selectedBreed == value) return; 
             _selectedBreed = value; 
             NotifyOfPropertyChange(() => SelectedBreed);  
Any help would be appreciated.
Feb 17, 2012 at 1:49 PM
Edited Feb 17, 2012 at 1:50 PM

Is it possible that the DevExpress ComboBoxEdit is not a Selector? In such a case, conventions would not work, so you should create your own. It's a wild guess, since I don't know the control in question.



I checked it, and indeed it is not a Selector, I am afraid you need to define a custom convention for that control.

Feb 17, 2012 at 2:02 PM

hmmm more fun... How would I do it with the normal WPF combobox then?

Feb 17, 2012 at 2:04 PM
Edited Feb 17, 2012 at 2:04 PM

In case of Selectors, the SelectedItem is automagically TwoWay-bound to the SelectedBreeder property by CM, so no further action is needed.