我想通过输入来搜索ListBox中的项目。我发现它可以通过TextSearch Property完成。
ListBox XAML:
<ListBox x:Name="SzablonyBox" HorizontalAlignment="Center"
HorizontalContentAlignment="Center" VerticalAlignment="Center"
MinWidth="100" MinHeight="100" BorderBrush="{x:Null}"
Background="{x:Null}" TextSearch.TextPath="Text" IsTextSearchEnabled="True">
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<EventSetter Event="PreviewKeyDown" Handler="ListBoxItem_PreviewKeyDown"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<DockPanel>
<TextBlock Text="{Binding nazwa}" FontWeight="Bold"
FontSize="15" Height="35"
VerticalAlignment="Center" HorizontalAlignment="Center"
TextAlignment="Justify"/>
</DockPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
如何设置TextSearch.TextPath="Text"
来管理ListBox项目(TextBlock文本)?