【发布时间】:2014-07-29 12:48:17
【问题描述】:
你好,我搜索了很多关于这个问题,但我没有找到,所以我来这里问我有这个代码:
<ComboBox TabIndex="10" x:Name="cbo_uf" HorizontalAlignment="Left" Margin="69,76,0,0" VerticalAlignment="Top" Width="52" Foreground="#FF4C63CB" ItemsSource="{Binding}" SelectionChanged="cbo_uf_SelectionChanged" Grid.RowSpan="3" Height="23">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding uf}" Width="50" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
为了填充这个 ComboBox,我为 DataContext 设置了一个来自选择查询 sql 的 DataTable,“uf”是 DataTable 中列的名称,它在 ComboBox 上显示正常,但我希望当我按下一些键组合框转到以该键开头的行,就像我将文本放入 ComboBoxItem 时一样。对不起我的英语!
【问题讨论】: