【发布时间】:2020-02-17 04:56:01
【问题描述】:
我正在开发一个 UWP 应用,我有一个包含国家名称、国旗和国家代码列表的下拉列表。当我单击下拉列表时,国家列表打开。但是,如果我单击并按下任何字母(例如 I),它不会自动滚动到列表以 I 开头的列表。
我尝试将 IsTextSearchEnabled 属性添加到下拉列表中,但没有得到想要的结果。请谁能指导我这里需要做什么?
<ComboBox x:Name="CmbCountrylist" Height="auto" IsEditable="True"
IsTextSearchEnabled="True" Width="250" Margin="0,0,1,0" Background="red"
PlaceholderText="Select Country"
SelectionChanged="CmbCountryCodes1_SelectionChanged"
HorizontalAlignment="Left" VerticalAlignment="Center">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" ToolTipService.ToolTip="{Binding name}" >
<Image x:Name="ImgFlag" Width="16" Height="16" Margin="0,2,5,2" VerticalAlignment="Center" HorizontalAlignment="Left" Source="{Binding ImagePath}" />
<TextBlock x:Name="txtCountryName" Text="{Binding name}" />
<TextBlock x:Name="txtCode" Text="{Binding dial_code}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
【问题讨论】: