Saturday, August 6, 2011

WPF-Basic ComboBox Example

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

How to upload app to macOS

1. Open Terminal Press Cmd (⌘) + Space , type Terminal , and hit Enter . 2. Navigate to Your Build Output Directory Your .app file is likel...