Why does the SelectedItem not display in combobox
-
30-10-2019 - |
Pergunta
With the below binding in XAML, the selected item is not displayed in a combobox (specifically, the current type is not displayed for a site). We are using the caliburn micro framework and DevForce Ideablade. MySite is an Ideablade entity.
<ComboBox Grid.Column="3" Grid.Row="3"
ItemsSource="{Binding MySiteTypes}"
DisplayMemberPath="description"
SelectedItem="{Binding MySite.SiteType, Mode=TwoWay}"
SelectedValuePath="description"/>
Code in the ViewModel:
private BindableCollection<SiteType> _mySiteTypes;
public BindableCollection<SiteType> MySiteTypes
{
get { return _mySiteTypes; }
set { _mySiteTypes = value; NotifyOfPropertyChange(() => MySiteTypes); }
}
Once I set the site type with the combobox (the types are present in the dropdown), it correctly displays the type and changes the type in the database. What am I missing, why doesn't it want to display the existing type the first time?
Nenhuma solução correta
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow