因为datagridtemplatecolumn不在Virsual Tree中,不能继承DataGrid的DataContext,

所以想要绑定到datagridtemplatecolumn的 visibility ,需要添加一个代理

1、在Resources添加FrameworkElement,DataContext绑定为当前DataContext

<UserControl.Resources>
<FrameworkElement x:Key="ProxyElement" DataContext="{Binding}"/>
</UserControl.Resources>

2、添加一个ContentControl,Conent绑定到以上的FrameworkElment(这步的目的是将这个Element添加到VirsualTree)

<!--只是将ProxyElement添加到树-->
<ContentControl Content="{StaticResource ProxyElement}" Visibility="Collapsed"/>

3、datagridtemplatecolumn的Visiblity绑定到ProxyElement

Visibility="{Binding DataContext.IsManager, Source={StaticResource ProxyElement},Converter={StaticResource ConverterBoolToVisibilityCollapsed}}"

wpf datagridtemplatecolumn visibility binding的更多相关文章

  1. 【转】WPF中的Binding技巧(二)

    WPF中的Binding技巧(二)     接上篇, 我们来看一看Elementname,Source,RelativeSource 三种绑定的方式 1.ElementName顾名思义就是根据Ui元素 ...

  2. Impossible WPF Part 1: Binding Properties

    原文 http://www.11011.net/wpf-binding-properties Ever wanted to write the following? <RichTextBoxDo ...

  3. [XAML]类似WPF绑定的Binding的读取方法

    在WPF的XAML里,依赖属性可以使用基于BindingBase之类的MarkupExtensin 读取XAML时,会自动的把该BindingBase转换为BindingExpressionBase ...

  4. [WPF系列]-使用Binding来同步不同控件的Dependency property

    简介 项目中经常会用到,同步两个控件的值,本文就简单列举两种方式来同步不同控件的两个Dependency Property. 示例 效果图: 只使用C#代码: //获取slider1的ValueDep ...

  5. (WPF) 再议binding:点击User Control时,User Control变换颜色或做其他的处理。

    Binding 是前台UI(显示层)和后台代码(数据层)的桥梁.理论上当后台的数据变动时,显示的数据或样式应该随之而变.这些是动态的. 对于Binding的设置可以在前台Xaml,也可以在后台Code ...

  6. Impossible WPF Part 2: Binding Expressions

    原文 http://www.11011.net/wpf-binding-expressions Back in April I posted an idea for building an expre ...

  7. silverlight wpf DataTemplate Command binding

    <Grid x:Name="LayoutRoot" Background="White"> <CommonControl:NoapDataGr ...

  8. 解读WPF中的Binding

    1.Overview 基于MVVM实现一段绑定大伙都不陌生,Binding是wpf整个体系中最核心的对象之一这里就来解读一下我花了纯两周时间有哪些秘密.这里我先提出几个问题应该是大家感兴趣的,如下: ...

  9. (WPF, MVVM) Textbox Binding

    参考:http://msdn.microsoft.com/en-us/library/system.windows.data.updatesourcetrigger(v=vs.110).aspx Te ...

随机推荐

  1. 禁止tomcat扫描jar包的tld文件

    禁止tomcat扫描jar包的tld文件tomcat/conf/logging.properties 取消注释org.apache.jasper.compiler.TldLocationsCache. ...

  2. SHRINK SPACE Command : Online Segment Shrink for Tables, LOBs and IOTs

    ORACLE-BASE - ALTER TABLE ... SHRINK SPACE Command : Online Segment Shrink for Tables, LOBs and IOTs ...

  3. rabbitmq镜像模式初体验

    rabbitmq-01: yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm wget ...

  4. Java数组!!!你知多少?

    这是一篇网上搜到的文章,对数组进行了充分的说明.楼主懂了数组的俩种初始化方式:静态初始化和动态初始化方式.(贴过来备用哦) 下面我带大家一起加深一下对Java数组的认识: 1.理解数组 数组也是一种数 ...

  5. 【SQL】MERGE

    MERGE可以合并多个表中的数据,也可实现多表中数据的同步.使用MERGE语句对表中数据进行有条件的更新和插入.当查找的行存在时,UPDATE更新行中的数据:当查找的行不存在时,INSERT插入数据. ...

  6. openMSP430之io_test

    openMSP430: IO functionality test with interupt #include "omsp_system.h" volatile char shi ...

  7. 图像局部显著性—点特征(GLOH)

    基于古老的Marr视觉理论,视觉识别和场景重建的基础即第一阶段为局部显著性探测.探测到的主要特征为直觉上可刺激底层视觉的局部显著性--特征点.特征线.特征块. 相关介绍:局部特征显著性-点特征(SIF ...

  8. C++程序设计实验安排

    2016-2017第二学期C++程序设计的实验时间与地点安排如下表,请大家根据时间按时来上机实验.另外,因为原来安排在4.1的实验因为调休补周一的课,因此挪至周五.另外第4次周六的课,考虑有一些同学有 ...

  9. Shiro Shiro Web Support and EnvironmentLoaderListener

    Shiro Shiro Web Support 主要参考: http://shiro.apache.org/web.html 还有涛哥的 作为资源控制访问的事情,主要使用在网络后台方面,所以了解了本地 ...

  10. JS的Key-Val(键值对)设置Key为动态的方法

    问题描述: 需要生成一个对象, 这个对象为 {key: value}, 现在要让key是动态的 解决方案: function(key, value){ let keyValue = {}; keyVa ...