TreeView CheckBoxes WPF

时间:2010-03-24 10:16:26

标签: wpf xaml checkbox treeview

如何在没有ListView和TreeListView的情况下在XAML中创建

1 个答案:

答案 0 :(得分:0)

<TreeView>
<TreeView.ItemContainerStyle>
    <Style
        TargetType='TreeViewItem'>
        <Setter
            Property='Template'>
            <Setter.Value>
                <ControlTemplate
                    TargetType='TreeViewItem'>
                    <StackPanel
                        Orientation='Horizontal'>
                        <CheckBox
                            Width='40'
                            Content='A' />
                        <CheckBox
                            Width='40'
                            Content='B' />
                        <!--
                        the rest of the TreeViewItem template here
                        http://msdn.microsoft.com/en-us/library/ms788727.aspx
                        -->
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</TreeView.ItemContainerStyle>