TreeCategory.xaml 2.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. <UserControl x:Class="FWindSoft.Wpf.Controls.TreeCategory"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:controls="clr-namespace:FWindSoft.Wpf.Controls"
  5. Name="this" Width="{Binding Width, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UIElement}}" Height="{Binding Height, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UIElement}}">
  6. <Grid>
  7. <TreeView x:Name="tree" Margin="0,0,0,0" Grid.Row="0" Grid.Column="0" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True">
  8. <TreeView.ItemContainerStyle>
  9. <Style TargetType="TreeViewItem">
  10. <Setter Property="IsExpanded" Value="{Binding IsExpanded,Mode=TwoWay}"></Setter>
  11. </Style>
  12. </TreeView.ItemContainerStyle>
  13. <TreeView.ItemTemplate>
  14. <HierarchicalDataTemplate ItemsSource="{Binding Path=Items}">
  15. <Border>
  16. <Grid>
  17. <Grid.ColumnDefinitions>
  18. <ColumnDefinition Width="Auto"></ColumnDefinition>
  19. <ColumnDefinition></ColumnDefinition>
  20. </Grid.ColumnDefinitions>
  21. <CheckBox
  22. FontSize="14"
  23. FontFamily="微软雅黑"
  24. Tag="{Binding}"
  25. IsChecked="{Binding Path=IsChecked,Mode=TwoWay}" VerticalAlignment="Center" Command="controls:TreeCategory.SelectCommand" CommandParameter="{Binding}"></CheckBox>
  26. <TextBlock Grid.Column="1" Text="{Binding Path=Display}"></TextBlock>
  27. </Grid>
  28. </Border>
  29. </HierarchicalDataTemplate>
  30. </TreeView.ItemTemplate>
  31. </TreeView>
  32. </Grid>
  33. </UserControl>