WPF未知的viewmodel自定义控件 [英] WPF unknown viewmodel custom control

查看:102
本文介绍了WPF未知的viewmodel自定义控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨大家,

我正在开发一个自定义控件,允许用户使用层次数据级别。

数据示例:



节点1

节点1.1

节点1。 2

Node1.2.1

Node1.2.2

节点2

节点3

Node3.1

Node3.2

节点4



控件显示当前的数据级别例如Node3(3.1和3.2)的所有子节点,用户可以移动到上层和下层。

问题是,我不知道视图模型对象的类类型,所以我不知道哪个属性包含每个节点的子节点。因为我需要访问这些子节点进行导航,所以我无法在数据模板中使用绑定,因为尚未创建相关项。

解决方案

这里你去:对WPF中树视图的基本理解 [ ^ ]

Hi Guys,
at the moment I am working on a custom control that allows the user to levels of hierarchical data.
Data example:

Node 1
Node1.1
Node1.2
Node1.2.1
Node1.2.2
Node 2
Node 3
Node3.1
Node3.2
Node 4

The control displays the current level of data for example all child’s of Node3 (3.1 and 3.2) and the user can move to upper and lower level.
The problem with that is, that I don´t know the class type of the view model objects so I don´t know which property contains the child nodes of each node. As I need to access these child nodes for navigation I can´t use binding in a data template because the related items aren’t yet created.

解决方案

Here U Go : Basic Understanding of Tree View in WPF[^]


这篇关于WPF未知的viewmodel自定义控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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