WPF 自定义的ComboBox 给定了ItemsSource和SelectedItem 但是SelectedIndex="0" 无效,无法设定默认值 10
SelectedIndex="0"无效,无法设定默认值,要怎么设置才能显示默认值啊??<ComboBoxGrid.Column="3"Width="140"Margin=...
SelectedIndex="0" 无效,无法设定默认值, 要怎么设置才能显示默认值啊??
<ComboBox Grid.Column="3" Width="140" Margin="0,0,0,0" SelectedIndex="0" ItemsSource="{Binding CashierSiteModels}" SelectedItem="{Binding SelectedCashierSiteModel,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding CashierSiteName}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox> 展开
<ComboBox Grid.Column="3" Width="140" Margin="0,0,0,0" SelectedIndex="0" ItemsSource="{Binding CashierSiteModels}" SelectedItem="{Binding SelectedCashierSiteModel,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding CashierSiteName}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询