简体   繁体   English

如何滚动到Windows Phone 7中列表框中的选定项目

[英]How to Scroll into selected item in listbox in windows phone 7

I want to scroll into selected item in a list box .for that now I am using one line of code in Listbox1_SelectionChanged event, but scroll is not working. 我想滚动到列表框中的选定项目。因为现在我在Listbox1_SelectionChanged事件中使用一行代码,但滚动不起作用。 I tried the same in a button click that is working fine . 我在按钮单击中尝试了相同的工作正常。

Listbox1.ScrollIntoView(Listbox1.Items[Listbox1.SelectedIndex]);

I used in my solution first updated UI and the called ScrollIntoView it works fine: 我在我的解决方案中使用了第一个更新的UI和被调用的ScrollIntoView它工作正常:

follow this link for more info 点击此链接获取更多信息

Listbox1.UpdateLayout();
Listbox1.ScrollIntoView(Listbox1.Items[Listbox1.SelectedIndex]);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM