UWP - AutoSuggestBox不显示基于窗口位置的项目。错误? [英] UWP - AutoSuggestBox not displaying items based on position in window. Bug?
问题描述
以下代码仅显示第3个框的AutoSuggestBox弹出窗口的内容。 我已经确认这是由于窗口中的位置造成的。 前两个AutoSuggestBox没有显示,第三个按预期工作。
项目创建为目标版本Windows 10 Creators更新(10.0; Build 15063),最低版本Windows 10月11日更新(10.0; Build 10586)。
任何人都知道这个bug的解决方案吗?
谢谢,
Chris
MainPage.xaml
x:Class =" CSharpTestAutoSuggestBox.MainPage"
xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x =" http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local =" using:CSharpTestAutoSuggestBox"
xmlns:d =" http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc =" http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable =" d">
我检查了 的文件 AutoSuggestBox
Class 和官方样本 XamlAutoSuggest Box 。
我发现所有样本都使用AutoSuggestBox.ItemSource作为源。它显示弹出窗口。
我建议你可以使用AutoSuggestBox.ItemSource而不是使用AutoSuggestBox.item。
您可以创建一个列表并添加所需的字符串。然后将列表分配给ItemSource属性。
这是代码:
private void Test1SuggestBox_TextChanged(AutoSuggestBox sender,AutoSuggestBoxTextChangedEventArgs args)
{
if(args.Reason == AutoSuggestionBoxTextChangeReason) .UserInput)
{
List< string> itemssource = new List< string>();
itemssource.Add(" Item A");
itemssource。添加(" Item B");
itemssource.Add(" Item C");
itemssource.Add(" Item D");
Test1SuggestBox.ItemsSource = itemssource;
//Test1SuggestBox.Items.Clear();
//Test1SuggestBox.Items.Add("Item A");
//Test1SuggestBox.Items。添加(" Item B");
//Test1SuggestBox.Items.Add("Item C");
}
}
< p style ="margi正底部:0.0001pt; line-height:normal">
并且应用程序中的节目很好:
最好的问候,
罗伊跨度>
This following code will only display the contents of the AutoSuggestBox popup for the 3rd box. I have confirmed that this is due to the position in the window. The first two AutoSuggestBoxes show nothing and the third works as expected.
Project created as Target Version Windows 10 Creators Update (10.0; Build 15063), Minimum Version Windows 10 November Update (10.0; Build 10586).
Anyone know of a solution to this bug?
Thanks,
Chris
MainPage.xaml
x:Class="CSharpTestAutoSuggestBox.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:CSharpTestAutoSuggestBox"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
I checked the document of AutoSuggestBox Class and the official sample XamlAutoSuggestBox. I found all the sample are using AutoSuggestBox.ItemSource as source. And it shows the popup well.
I suggest that you could use AutoSuggestBox.ItemSource instead of using AutoSuggestBox.item.
You could create a list and add the strings that you want. Then assign the list to the ItemSource property.
Here is the code:
private void Test1SuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args) { if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput) { List<string> itemssource = new List<string>(); itemssource.Add("Item A"); itemssource.Add("Item B"); itemssource.Add("Item C"); itemssource.Add("Item D"); Test1SuggestBox.ItemsSource = itemssource; //Test1SuggestBox.Items.Clear(); //Test1SuggestBox.Items.Add("Item A"); //Test1SuggestBox.Items.Add("Item B"); //Test1SuggestBox.Items.Add("Item C"); } }
And the shows well in the app:
Best regards,
Roy
这篇关于UWP - AutoSuggestBox不显示基于窗口位置的项目。错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!