WPF TreeGrid Binding 简易实现方式
在設計TreeView編輯狀況下,希望 TreeItemName 后续的编辑框 复选框 可以整齐排列。

参考微软提供的TREELISTVIEW,发现它是根据层级关系调整Margin 属性。
我这边按照同样的方式,实现WIDTH的宽度的递减,就可实现需要的效果。
<HierarchicalDataTemplate x:Key="TreeNodes" ItemsSource="{Binding Path=Childs,Mode=TwoWay}" >
<Grid DataContext="{Binding}" Width="{Binding Level,
Converter={StaticResource
LevelToWidthConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="" />
<ColumnDefinition Width="" />
<ColumnDefinition Width="" />
<ColumnDefinition Width="" />
<ColumnDefinition Width="" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Name}" />
<CheckBox Grid.Column="" IsChecked="{Binding IsCheck}"
IsEnabled="{Binding Path=DataContext.IsInput,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}"
>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:InvokeCommandAction Command="{Binding Path=DataContext.NodeChangeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}"
CommandParameter="{Binding Id}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</CheckBox>
<CheckBox Grid.Column="" IsChecked="{Binding HasAdd,Mode=TwoWay}"
IsEnabled="{Binding Path=DataContext.IsInput,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}"
>
</CheckBox>
<CheckBox Grid.Column="" IsChecked="{Binding HasEdit,Mode=TwoWay}"
IsEnabled="{Binding Path=DataContext.IsInput,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}"
>
</CheckBox>
<CheckBox Grid.Column="" IsChecked="{Binding HasEditDetail,Mode=TwoWay}"
IsEnabled="{Binding Path=DataContext.IsInput,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}"
>
</CheckBox>
<CheckBox Grid.Column="" IsChecked="{Binding HasDelete,Mode=TwoWay}"
IsEnabled="{Binding Path=DataContext.IsInput,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}"
>
</CheckBox>
</Grid>
</HierarchicalDataTemplate>
WPF TreeGrid Binding 简易实现方式的更多相关文章
- WPF之Binding深入探讨
原文:http://blog.csdn.net/fwj380891124/article/details/8107646 1,Data Binding在WPF中的地位 程序的本质是数据+算法.数据会在 ...
- WPF数据绑定Binding(二)
WPF数据绑定Binding(二) 1.UI控件直接的数据绑定 UI对象间的绑定,也是最基本的形式,通常是将源对象Source的某个属性值绑定 (拷贝) 到目标对象Destination的某个属性上. ...
- WPF的Binding功能解析
1,Data Binding在WPF中的地位 程序的本质是数据+算法.数据会在存储.逻辑和界面三层之间流通,所以站在数据的角度上来看,这三层都很重要.但算法在3层中的分布是不均匀的,对于一个3层结构的 ...
- WPF之Binding深入探讨--Darren
1,Data Binding在WPF中的地位 程序的本质是数据+算法.数据会在存储.逻辑和界面三层之间流通,所以站在数据的角度上来看,这三层都很重要.但算法在3层中的分布是不均匀的,对于一个3层结构的 ...
- WPF之Binding【转】
WPF之Binding[转] 看到WPF如此之炫,也想用用,可是一点也不会呀. 从需求谈起吧: 首先可能要做一个很炫的界面.见MaterialDesignInXAMLToolKit. 那,最主要的呢, ...
- WPF之Binding深入探讨 转载:http://blog.csdn.net/fwj380891124/article/details/8107646
1,Data Binding在WPF中的地位 程序的本质是数据+算法.数据会在存储.逻辑和界面三层之间流通,所以站在数据的角度上来看,这三层都很重要.但算法在3层中的分布是不均匀的,对于一个3层结构的 ...
- 【转】WPF中Binding的技巧(一)
WPF中Binding的技巧(一) 在WPF应用的开发过程中Binding是一个非常重要的部分. 在实际开发过程中Binding的不同种写法达到的效果相同但事实是存在很大区别的. 这里将实际中碰到 ...
- WPF之Binding的使用
引出: 在WPF中Binding可以比作数据的桥梁,桥梁的两端分别是Binding的源(Source)和目标(Target).一般情况下,Binding源是逻辑层对象,Binding目标是UI层的控件 ...
- 深入浅出WPF之Binding的使用(一)
在WPF中Binding可以比作数据的桥梁,桥梁的两端分别是Binding的源(Source)和目标(Target).一般情况下,Binding源是逻辑层对象,Binding目标是UI层的控件对象:这 ...
随机推荐
- JS使用正则表达式获取小括号、中括号及花括号内容的方法示例
本文实例讲述了JS使用正则表达式获取小括号.中括号及花括号内容的方法.分享给大家供大家参考,具体如下: JS 正则表达式 获取小括号 中括号 花括号内的内容 <!DOCTYPE html> ...
- MyBatis(4)——配置文件优化
配置文件优化 执行流程:读取配置流程->sqlSessionFactory->sqlSession(连接.读取sql并执行相应操作.关闭) a)配置优化:通过中文参考指南的说明可知-> ...
- 【代码总结】Struts2 Action接受参数方式的对比
一.属性方式 1.Action中:对应表单参数的setter.getter 2.页面中 :Form中元素name取值属性名 <s:property value="属性名" ...
- 【资源分享】RPG Maker 2000/2003 简体中文版
*----------------------------------------------[下载区]----------------------------------------------* ...
- Atcoder Beginner Contest152F(DFS+状压DP)
二维状压写成一维状压,省略加上第i条边这一维 #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace st ...
- yii2 password hash生成与验证方法
1.生成 $password是明文.如:123456 $this->password_hash = Yii::$app->security->generatePasswordHash ...
- pwnable.kr-flag-Writeup
MarkdownPad Document *:first-child { margin-top: 0 !important; } body>*:last-child { margin-botto ...
- Java中List集合的逆序排列
Collections.reverse(list); //实现List集合逆序排列
- Springmvc-crud-02错误(添加出现中文乱码)
错误: 在进行添加页面时使用post请求,输入中文时会出现乱码 原因: post请求不支持gbk格式,使用字符编码过滤器,设置为UTF-8编码即可 注意配置请求的字符集和响应字符集 解决方案:需要放在 ...
- 安卓开发:打印Log
在iOS开发中使用NSLog进行打印调试,在安卓中使用的是Log.v(tag, msg);等进行打印调试. 参考:[https://blog.csdn.net/salary/article/detai ...