Windows Phone:如何根据内部元素值以编程方式在LongListSelector中选择项目

问题描述:

我有一个带有文本块的页面,该文本块包含字符串值.当用户单击/轻击此按钮时,将使用LongListSelector来启动新页面,其中包含对象列表,其中一个对象包含可以与给定值匹配的字符串.我该如何设置第一个 返回为SelectedItem并在页面顶部查看?

I have a page with a textblock that contains string value. When user clicks/taps on this, starts a new page with a LongListSelector that contains a list of objects where one of those contains a string that can match with given value. How can I set the first retreived as SelectedItem and view it at the top of the page?

预先感谢

您可以使用

You can use the ScrollTo object method in LongListSelector.

虽然它可能没有设置在页面顶部.

It may not set it to the top of the page though.

如果需要微调控件,则可以使用在 Windows Phone工具包(并在真正需要时编辑源代码).

If you need to fine tune the control you can use one of the alternate list selectors found in the Windows Phone Toolkit (and edit the source if truly needed).

关于LLS(在MVVM模型中使用)的一般用法, Twitter示例可能会有所帮助.

Regarding general usage of LLS (as used in the MVVM model), the Twitter sample can be helpful.

-马克