Kategorie-Archve: Windows Presentation Foundation

Binding a Dictionary to a ComboBox

View code (XAML): <ComboBox ItemsSource="{Binding Items}" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding SelectedItemCode}"/> ViewModel code: // Key = ItemCode, Value = Name public IDictionary<string, string> Items{get; private set;} public string SelectedItemCode { get { return Settings.Default.SelectedItemCode; } set { if (Settings.Default.SelectedItemCode != value) … Weiterlesen

Veröffentlicht unter Windows Presentation Foundation | Verschlagwortet mit , , , , | Hinterlasse einen Kommentar