美好的一天,
我想要我的组合框选择其中的第一个项目.我正在使用C#和WPF.我从DataSet读取数据.要填充组合框:
@H_502_4@DataTable sitesTable = clGast.SelectAll().Tables[0]; cbGastid.ItemsSource = sitesTable.DefaultView;组合框XAML代码:
@H_502_4@<ComboBox Name="cbGastid" ItemsSource="{Binding}" DisplayMemberPath="Description" SelectedItem="{Binding Path=id}" IsSynchronizedWithCurrentItem="True" />如果我尝试:
@H_502_4@cbGastid.SelectedIndex = 0;它不工作