Question

I'd like to give the user the ability to resize TreeView node by dragging its border, the same way you would resize a window.

What control should I put inside TreeNode template to make this possible?

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

Was it helpful?

Solution

I was playing with GridSpliter and was reminded about your question. Here's another way to do it, more light way, without 3rd party controls, besides it's 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>

OTHER TIPS

you can use avalon docking lib. It's free and super easy to setup. There are a few posts even here (on stack overflow). But basically you can just pin treeview to the side, set some properties not to allow floating or close, and you're good to go.

overview/tutorial http://avalondock.codeplex.com/documentation

download of 1.3: http://avalondock.codeplex.com/releases/view/48794

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top