每次点击执行DataTemplateSelector [英] Execute DataTemplateSelector on Each Click

查看:76
本文介绍了每次点击执行DataTemplateSelector的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在TreeViewControl中使用DataTemplateSelector,因为它有一个称为"SelectTemplate"的虚拟方法.

Hi,

I am using DataTemplateSelector in TreeViewControl and as it has a virtual method called "SelectTemplate".

public override DataTemplate SelectTemplate(object item, DependencyObject dependencyObject)
 {


}

众所周知,当我们单击树视图节点时,将调用SelectTemplate方法.现在,再次,如果我们单击同一节点,它不会执行众所周知的SelectTemplate方法.

但是是否有任何选项,属性或任何替代方法,以便每次我在任何节点或同一节点上单击时都会调用SelectTemplate方法,以便它调用SelectTemplate方法.

在此先感谢:)


}

As we all know that, SelectTemplate method will be called when we click on the tree view node. Now, again if we click on same node it does not execute SelectTemplate method as we all know.

But is there any option, property or any alternatives so that SelectTemplate method gets called everytime I click on any node or same node so that it calls SelectTemplate method.

Thanks in advance :)

推荐答案

为什么需要通过代码来完成?我在此处 [
Why do you need to do it from code? There is an alternative which I describe here[^]. By doing this, you have one DataTemplate (which controls the conditions for switching the templates), and you change the other DataTemplates to ControlTemplates.


这篇关于每次点击执行DataTemplateSelector的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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