I would suggest using an observable property in your Viewmodel:
private CollectionView _comboBoxOptions = null;
public CollectionView comboBoxOptions
{
get { return _comboBoxOptions; }
set
{
if (_comboBoxOptions != value)
{
_comboBoxOptions = value;
RaisePropertyChanged("comboBoxOptions");
}
}
}
You would also have to use INotifyPropertyChanged in the Viewmodel:
public event PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string name)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(name));
}
Then in your XAML bind your control to that property :
<ComboBox>
<Binding Path="comboBoxOptions"
ValidatesOnDataErrors="True"
NotifyOnValidationError="True"
Mode="OneWay"
UpdateSourceTrigger="LostFocus"/>
</ComboBox>
You could initialise the comboBoxOptions property in the constructor for your Viewmodel.
Hope this helps
Laurence