WPF Treegrid Binding Simple Implementation method

Source: Internet
Author: User

In the design of the TreeView editor, you want to treeitemname the subsequent edit box check boxes neatly.

Refer to the TreeListView provided by Microsoft and find that it adjusts the margin properties according to the hierarchical relationship.

My side, in the same way, to achieve the width of the reduction, you can achieve the desired effect.

"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="1"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="2"Ischecked="{Binding Hasadd,mode=twoway}"isenabled="{Binding path=datacontext.isinput,relativesource={relativesource mode=findancestor,ancestortype={x:type Page} }}"> </CheckBox> <checkbox grid.column="3"Ischecked="{Binding Hasedit,mode=twoway}"isenabled="{Binding path=datacontext.isinput,relativesource={relativesource mode=findancestor,ancestortype={x:type Page} }}"> </CheckBox> <checkbox grid.column="4"Ischecked="{Binding Haseditdetail,mode=twoway}"isenabled="{Binding path=datacontext.isinput,relativesource={relativesource mode=findancestor,ancestortype={x:type Page} }}"> </CheckBox> <checkbox grid.column="5"Ischecked="{Binding Hasdelete,mode=twoway}"isenabled="{Binding path=datacontext.isinput,relativesource={relativesource mode=findancestor,ancestortype={x:type Page} }}"> </CheckBox> </Grid> </HierarchicalDataTemplate>

WPF Treegrid Binding Simple Implementation method

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.