从C#文件更新页面中的LongList [英] update LongList in page from c# file

查看:90
本文介绍了从C#文件更新页面中的LongList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我的页面上有一个LongList.该列表是在另一个c#类中创建的.如何更新我的清单?我知道我必须使用INotifyPropertyChanged,但是我找不到任何带有extern类的示例.我正在使用WP8.

解决方案

TwitterSearch 示例代码可以帮助演示首选的MVVM模型,以构建可视化UI的体系结构及其绑定的数据.

在TwitterSearch示例中,_viewModel被声明并在MainPage类中用于访问TwitterViewModel的实例. TwitterViewModel包含数据绑定到UI的集合.

您可以将_viewModel作为方法中的参数传递给另一个类,或者可以在App类中设置_viewModel,将其声明为静态并将其引用为App._viewModel(尽管按照惯例,您可能应删除下划线). /p>

希望这会有所帮助,
标记


Hello,

I have in a page a LongList. The list is created in another c# class. How can I update my list? I know I have to use INotifyPropertyChanged, but I couldn't find any example with an extern class for the list. I'm using WP8.

解决方案

Hi,

The TwitterSearch sample code can be helpful demonstrating a preferred model MVVM for structuring the architecture of the visual UI and the data bound to it.

In the TwitterSearch sample, _viewModel is declared and used in the MainPage class for access to an instance to TwitterViewModel. TwitterViewModel contains the collection that is databound to the UI.

You can pass _viewModel to another class as a parameter in a method, or you can set _viewModel in the App class, declare it static and reference it as App._viewModel (though by convention you probably should remove the underscore).

Hope this helps,
Mark


这篇关于从C#文件更新页面中的LongList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆