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

If you’re using Visual Studio to build your .NET MAUI app on a Mac, locating the IPA (iOS App Package) file can be a bit tricky

  If you’re using   Visual Studio   to build your   .NET MAUI   app on a   Mac , locating the   IPA (iOS App Package)   file can be a bit tr...