How to smooth WPF TreeView

I need a control that behaves like a tree (binds to a tree structure, expands child nodes based on the IsExpanded property of the linked object), but displays data such as a grid (without padding or switching images).

Collapse everything will happen automatically based on the associated object.

TreeView is perfect, I just need to remove the indentation and the image of the triangle to make it vertically flat, like a grid column.

I assume I can try to override the TreeViewItem template, but this does not display anything.

+5
source share
2 answers

TreeView MSDN, - :

<Style TargetType="TreeViewItem">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="TreeViewItem">
                <StackPanel>
                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="ExpansionStates">
                            <VisualState x:Name="Expanded">
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames
                                        Storyboard.TargetProperty="(UIElement.Visibility)"
                                        Storyboard.TargetName="ItemsHost">
                                        <DiscreteObjectKeyFrame KeyTime="0"
                                            Value="{x:Static Visibility.Visible}" />
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="Collapsed" />
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                    <ContentPresenter ContentSource="Header" />
                    <ItemsPresenter Name="ItemsHost" Visibility="Collapsed" />
                </StackPanel>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
+2

TreeListView ( TreeView ListView TreeViewItem)

http://msdn.microsoft.com/en-us/library/ms771523.aspx

+2