CardBaseStyle.xaml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:hc="clr-namespace:HandyControl.Controls">
  4. <Style x:Key="CardBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="hc:Card">
  5. <Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
  6. <Setter Property="BorderThickness" Value="1"/>
  7. <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
  8. <Setter Property="Focusable" Value="False"/>
  9. <Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
  10. <Setter Property="Template">
  11. <Setter.Value>
  12. <ControlTemplate TargetType="hc:Card">
  13. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
  14. <Grid>
  15. <Grid.RowDefinitions>
  16. <RowDefinition Height="Auto"/>
  17. <RowDefinition/>
  18. <RowDefinition Height="Auto"/>
  19. </Grid.RowDefinitions>
  20. <Border BorderThickness="0,0,0,1" Visibility="{TemplateBinding Header, Converter={StaticResource Object2VisibilityConverter}}" BorderBrush="{TemplateBinding BorderBrush}">
  21. <ContentPresenter ContentSource="Header" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" ContentStringFormat="{TemplateBinding HeaderStringFormat}"/>
  22. </Border>
  23. <ContentPresenter Grid.Row="1"/>
  24. <Border Grid.Row="2" BorderThickness="0,1,0,0" Visibility="{TemplateBinding Footer, Converter={StaticResource Object2VisibilityConverter}}" BorderBrush="{TemplateBinding BorderBrush}">
  25. <ContentPresenter ContentSource="Footer" ContentTemplate="{TemplateBinding FooterTemplate}" ContentTemplateSelector="{TemplateBinding FooterTemplateSelector}" ContentStringFormat="{TemplateBinding FooterStringFormat}"/>
  26. </Border>
  27. </Grid>
  28. </Border>
  29. </ControlTemplate>
  30. </Setter.Value>
  31. </Setter>
  32. </Style>
  33. </ResourceDictionary>