XBAP:
<ComboBox Name="MyComboBox" Grid.Column="1" Grid.Row="2">
</ComboBox>
Code Behind:
DataTable displayformat = GetNameList();
if (displayformat.Rows.Count > 0)
{ Binding displayBinding = new Binding();
displayBinding.Source = displayformat;
MyComboBox.SetBinding(ComboBox.ItemsSourceProperty, displayBinding);
MyComboBox.DisplayMemberPath = "Name";
MyComboBox.SelectedValuePath = "ID";
}
No comments:
Post a Comment