Flexible TreeView 5.1.9 Help
Use Flexible TreeView in WPF

Though Flexible TreeView is a WinForms component, it can be easily used in the WPF project right now by using the Windows Forms controls host facility with help of WindowsFormsHost class. At the same time all the rich Flexible TreeView functionality is available to you as in the Windows Forms version.

For example, below there is the sample of XAML which creates a treeview with the column and a text node control in it, and also adds the root and child node:

Flexible TreeView WPF host
Copy Code
<Window x:Class="FTVWpfTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ftv="clr-namespace:ARMSoft.FlexibleTreeView;assembly=ARMSoft.FlexibleTreeView"
        xmlns:col="clr-namespace:ARMSoft.FlexibleTreeView.Column;assembly=ARMSoft.FlexibleTreeView"
        xmlns:nodectrl="clr-namespace:ARMSoft.FlexibleTreeView.NodeControls;assembly=ARMSoft.FlexibleTreeView"
        xmlns:nodes="clr-namespace:ARMSoft.FlexibleTreeView.Nodes;assembly=ARMSoft.FlexibleTreeView"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <WindowsFormsHost>
            <ftv:FlexibleTreeView x:Name="tree" NodeExpanding="tree_NodeExpanding">
                <ftv:FlexibleTreeView.Columns>
                    <col:TreeColumn Text="test" Id="0" Width="150" />
                </ftv:FlexibleTreeView.Columns>
               
                <ftv:FlexibleTreeView.NodeControls>
                    <nodectrl:NodeTextBox ColumnId="0" DataFieldName="Text" />
                </ftv:FlexibleTreeView.NodeControls>
               
                <ftv:FlexibleTreeView.Nodes>
                    <nodes:Node Text="XAML node">
                        <nodes:Node.Nodes>
                            <nodes:Node Text="XAML sub-node"/>
                        </nodes:Node.Nodes>
                    </nodes:Node>
                </ftv:FlexibleTreeView.Nodes>
 
            </ftv:FlexibleTreeView>
        </WindowsFormsHost>
    </Grid>
</Window>

Note that the event handlers (NodeExpanding in the sample above) are added in XAML as easily as for the native WPF control.

 

 


Copyright © 2006-2016 ARMSoft

www.FlexibleTreeView.com