[UWP] [C ++] C ++中的数据绑定 [英] [UWP][C++]Data Binding in C++

查看:54
本文介绍了[UWP] [C ++] C ++中的数据绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我目前正在尝试制作一个简单的 C ++ UWP app ,它会显示包含多个元素的Listview。



网上有一些样本,但由于它们都是用C#制作的,所以我无法很好地将它们与我的项目集成。 (我对C#一无所知)



任何人都可以给我任何示例代码或整个项目在C ++中处理数据绑定吗?另外,任何人都可以解释(详细)绑定的步骤/过程吗?

解决方案

这个过程与C#中的方法大致相同。


您仍然实现了INotifyPropertyChanged,并且仍然将DataContext设置为ViewModel。


你继续以与在C#中完成相同的方式实现属性。


唯一值得注意的差异是ObservableCollection,它映射到ObservableVector。


否则,它只是语法的东西


https://msdn.microsoft.com/en-us/magazine/jj651573.aspx?f=255&MSPPError=-2147217396


I'm currently trying to make a simple C++ UWP app that displays a Listview with multiple elements.

There are some samples online, but since they're all made in C#, I can't integrate them with my project well. (I don't know anything about C#)

Can anybody give me any example code or an entire project that deals Data Binding in C++? Also, can anybody explain (in detail) the steps/process of binding?

解决方案

The process is much the same way as it is in C#.

You still implement the INotifyPropertyChanged, and you still set the DataContext to the ViewModel.

You continue to implement properties much the same way as it is done in C#.

The only notable differences is the ObservableCollection, which maps to ObservableVector.

Otherwise, it is just syntax stuff

https://msdn.microsoft.com/en-us/magazine/jj651573.aspx?f=255&MSPPError=-2147217396


这篇关于[UWP] [C ++] C ++中的数据绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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