如果我应用ItemTemplate,则自动完成功能不起作用

时间:2019-06-05 08:13:09

标签: wpf autocomplete syncfusion

我正在使用WPF中Syncfusion的AutoComplete控件。

一切正常,但是当我应用ItemTemplate时,当我在TextBox中输入一个条目时,建议框将不起作用,并且不会对项进行过滤。

我这样做:

<syncfusion:AutoComplete Grid.Row="2" Background="Transparent" TextBlock.Foreground="{StaticResource ColorBrushFactoGris}"                                                
                         Grid.Column="2" 
                         ItemsSource="{Binding DataContext.ListOfTowns, RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type UserControl}}}" 
                         DisplayMemberPath="TownName" 
                         SelectedItem="{Binding DataContext.SelectedTown, RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type UserControl}}}">                                                                                                       
                                    <syncfusion:AutoComplete.ItemTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding}" Style="{StaticResource TextBlockStyle}"/>
                                        </DataTemplate>
</syncfusion:AutoComplete.ItemTemplate>
</syncfusion:AutoComplete>

我尝试将自定义样式应用于建议框中的项目,因此我正在使用ItemTemplate属性,但是当我这样做时,建议框不再起作用。你知道为什么吗?

感谢您的答复。

0 个答案:

没有答案
相关问题