ListCategory.xaml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <UserControl x:Class="FWindSoft.Wpf.Controls.ListCategory"
  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. x:Name="this" Height="{Binding Height, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UIElement}}" Width="{Binding Width, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UIElement}}">
  6. <Grid>
  7. <ListBox Margin="0,0,0,0" Name="list" Grid.Row="0" Grid.Column="0" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True">
  8. <ListBox.ItemsPanel >
  9. <ItemsPanelTemplate>
  10. <WrapPanel Orientation="Vertical" Height="{Binding ElementName=list,Path=Height}"></WrapPanel>
  11. </ItemsPanelTemplate>
  12. </ListBox.ItemsPanel>
  13. <ListBox.ItemContainerStyle>
  14. <Style TargetType="{x:Type ListBoxItem}">
  15. <Setter Property="Template">
  16. <Setter.Value>
  17. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  18. <Border x:Name="Border" Margin="2,1,2,1" BorderThickness="2" VerticalAlignment="Center"
  19. Background="AliceBlue" OpacityMask="#FF61E4E4">
  20. <Grid>
  21. <Grid.ColumnDefinitions>
  22. <ColumnDefinition Width="Auto"></ColumnDefinition>
  23. </Grid.ColumnDefinitions>
  24. <CheckBox Content="{Binding Display}" IsChecked="{Binding IsChecked,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" Command="{x:Static controls:ListCategory.SelectCommand}"></CheckBox>
  25. </Grid>
  26. </Border>
  27. </ControlTemplate>
  28. </Setter.Value>
  29. </Setter>
  30. </Style>
  31. </ListBox.ItemContainerStyle>
  32. </ListBox>
  33. </Grid>
  34. </UserControl>