Allow user to resize WPF TreeView node by dragging and dropping

I would like to give the user the ability to resize the TreeView node by dragging its border, just as you would resize the window.

What control should be placed inside the TreeNode template to make this possible?

Or, if there is no such control, what is the best way to do this?

+3
source share
2 answers

I played with GridSpliter and was reminded of your question. Here is another way to do this, an easier way, without third-party controls, in addition, it is always nice to have options :) This is just a sample that gives you an idea about the grid splitter:

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition x:Name="Column1" Width="35*"/>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition x:Name="Column2" Width="65*"/>
    </Grid.ColumnDefinitions>
    <Border BorderBrush="Gray" BorderThickness="1" Margin="2">
        <TextBlock>your treeview</TextBlock>
    </Border>
    <GridSplitter Width="2" ResizeBehavior="PreviousAndNext" Grid.Column="1"/>
    <Border BorderBrush="Gray" BorderThickness="1" Grid.Column="2" Margin="2"/>
</Grid>
+4
source

All Articles