自定义 Silverlight TreeView 模板
我使用从 xml 文件加载的分层数据模板(每个节点旁边有按钮)构建树。
我想要做的是,当我按下节点旁边的按钮时,它将在树内的弹出窗口中打开节点详细信息(如树子节点)
任何想法???
我正在使用 Silverlight 4
I build tree with Hierarchical datatemplate (with button beside each node) loaded from xml file.
What I want to do is when i press the button beside the node it will open node details in a popup inside the tree (Like tree sub node)
Any ideas ????
I'm using Silverlight 4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确定您是否需要使用的布局控件类型(Canvas、Grid、Stackpanel)。
每个人都有自己的优点和缺点。
一旦你决定了这一点,就开始设计逻辑......然后你就开始编码。
如果你太懒了并且想要一个已经为你构建的控件/解决方案,你可以尝试用谷歌搜索它......我很确定你会找到样本/演示/源代码。
就我个人而言,我确实建议您花时间寻找示例和源代码,因为分层树视图比您想象的要复杂一些。特别是,节点放置的逻辑(使它们永远不会相互冲突)可能很复杂(取决于您的经验水平)。
如果你决定自己写,我为你鼓掌,你一定会通过这种方式学到更多。
哦,顺便说一句,不确定分层数据模板是什么意思。我建议你为单个节点编写一个用户控件。然后也许编写另一个控件(树视图控件)来管理所有节点以呈现层次结构树。
Determine if you want type of layout control you want to use (Canvas, Grid, Stackpanel).
Each has their strengths and weaknesses.
Once you decide on this, start designing the logic... then you start coding.
If you're too lazy and want a control/solution that's alreayd built for you, you can try googling it... which i'm pretty sure you'll find samples/demos/source-code for.
Personally i do recommend you spend time looking for samples and source-code, because a hierarchical treeview is a bit more complex than you might think. In particular, the logic for your node placements so that they never collide with each other could be complex (depending on your level of experience).
If you DO decide to write your own, I applaud you, and you will surely learn way more this way.
Oh by the way, not sure what you mean by hierarchical datatemplate. I suggest you write a usercontrol for a single Node. then maybe write another control (treeview control) that manages all the nodes to present the hierarchy tree.