标签:uwp windows-10 windows-runtime c
我想在应用程序的顶部显示弹出窗口并显示其他信息,我的信息是Listview,其中有500项我都尝试过:
>弹出问题->它可能里面有scrollViewer,所以我的listview不能正确地虚拟化其他一切正常.有我的代码:
Flyout myFlyout = new Flyout();
myFlyout.Placement = FlyoutPlacementMode.Full;
myFlyout.Content = myListView;
myFlyout.ShowAt(this);
>弹出问题->它没有居中,verticalAlignment不起作用,horizontal也没有
Popup myPopup = new Popup();
myPopup.Child = myListView;
myPopup.IsOpen = true;
那么我应该走哪条路,尝试编辑弹出框或通过设置垂直和水平偏移使弹出窗口居中?
或者有更好的方法来显示带有诸如项目列表之类的信息的窗口之类的弹出窗口
解决方法:
默认情况下,Flyout内部具有ScrollViewer.您可以在FlyoutPresenter styles and templates处找到其模板.可以根据需要设置Flyout.FlyoutPresenterStyle属性来对其进行编辑和使用新模板.
如果要使用Popup的HorizontalAlignment和VerticalAlignment属性,则需要将Popup添加为可视树中元素的子级.例如:
Popup myPopup = new Popup();
//MainGrid is the top Grid in the Page
MainGrid.Children.Add(myPopup);
myPopup.HorizontalAlignment = HorizontalAlignment.Center;
myPopup.VerticalAlignment = VerticalAlignment.Center;
myPopup.Child = myListView;
myPopup.IsOpen = true;
但是plesae注意,这实际上并未使Popup居中.它使Popup的左上角居中.在Popup class的“备注”部分中,它表示:
You position the Popup by setting the 07003 and 07004 properties. The Popup is offset relative to its immediate parent container.
我认为在使用HorizontalAlignment.Center和VerticalAlignment.Center时,它将HorizontalOffset和VerticalOffset设置为其父级的宽度和高度的一半.
并且在“备注”部分中,它还说:
Do not use a Popup if a 07005, 07006, 07007 or 07008 is more appropriate.
因此,我认为在您的情况下,使用Flyout是更好的方法.
标签:uwp,windows-10,windows-runtime,c 来源: https://codeday.me/bug/20191119/2036323.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。