Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何清除AutoSuggestBox项目_C#_Uwp - Fatal编程技术网

C# 如何清除AutoSuggestBox项目

C# 如何清除AutoSuggestBox项目,c#,uwp,C#,Uwp,我有一个AutoSuggestBox,它的ItemSource与我的VM绑定 <AutoSuggestBox x:Name="MyBox" Grid.Row="1" GotFocus="MyBox_GotFocus" QueryIcon="Find" PlaceholderText="Search" QuerySubmitted="MyBox_QuerySubmitted"

我有一个AutoSuggestBox,它的ItemSource与我的VM绑定

<AutoSuggestBox x:Name="MyBox" Grid.Row="1" GotFocus="MyBox_GotFocus"
                            QueryIcon="Find" PlaceholderText="Search"
                            QuerySubmitted="MyBox_QuerySubmitted"
                            TextMemberPath="Description"
                            Header="Search"
                            ItemsSource="{Binding SearchMatches}" 
                            Style="{StaticResource SearchAutoSuggestBoxStyle}" 
                            ItemTemplate="{StaticResource SearchItemTemplate}"/>

谢谢

在使用数据绑定时,您通常不希望直接与
项进行交互。请尝试在基础集合属性上清除

SearchMatches.Clear();

在使用数据绑定时,通常不希望直接与
项进行交互。请尝试在基础集合属性上清除

SearchMatches.Clear();

SearchMatches.Clear()
@JustinXL lol今天的代码太多了,我被一个简单的问题搞糊涂了xD,你能不能把它添加为答案,这样我就可以把它标记为答案谢谢大家。:)
SearchMatches.Clear()
@JustinXL lol今天的代码太多了,我被一个简单的问题搞糊涂了xD,你能不能把它添加为答案,这样我就可以把它标记为答案谢谢大家了。:)