code_junkie

Is it possible to reference control templates defined in microsoft's assemblies?

Nov 10th, 2011
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. <Style TargetType="{x:Type GridViewColumnHeader}" x:Key="gridViewColumnStyle">
  2. <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
  3. <Setter Property="VerticalContentAlignment" Value="Stretch"/>
  4. <Setter Property="Background" Value="{StaticResource GridViewHeaderBackgroundColor}"/>
  5. <Setter Property="BorderBrush" Value="{StaticResource GridViewHeaderForegroundColor}"/>
  6. <Setter Property="BorderThickness" Value="0"/>
  7. <Setter Property="Padding" Value="2,0,2,0"/>
  8. <Setter Property="Foreground" Value="{StaticResource GridViewHeaderForegroundColor}"/>
  9. <Setter Property="Template">
  10. <Setter.Value>
  11. <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
  12. <Grid SnapsToDevicePixels="true" Tag="Header" Name="Header">
  13. <ContentPresenter Name="HeaderContent" Margin="0,0,0,1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  14. <Canvas>
  15. <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource GridViewColumnHeaderGripper}"/>
  16. </Canvas>
  17. </Grid>
  18. <ControlTemplate.Triggers>
  19. <Trigger Property="IsMouseOver" Value="true">
  20. </Trigger>
  21. <Trigger Property="IsPressed" Value="true">
  22. <Setter TargetName="HeaderContent" Property="Margin" Value="1,1,0,0"/>
  23. </Trigger>
  24. <Trigger Property="Height" Value="Auto">
  25. <Setter Property="MinHeight" Value="20"/>
  26. </Trigger>
  27. <Trigger Property="IsEnabled" Value="false">
  28. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
  29. </Trigger>
  30. </ControlTemplate.Triggers>
  31. </ControlTemplate>
  32. </Setter.Value>
  33. </Setter>
  34. </Style>
  35.  
  36. <Style x:Key="GridViewColumnHeaderGripper"
  37. TargetType="{x:Type Thumb}">
  38. <Setter Property="Canvas.Right"
  39. Value="-9"/>
  40. <Setter Property="Width"
  41. Value="18"/>
  42. <Setter Property="Height"
  43. Value="{Binding Path=ActualHeight,RelativeSource={RelativeSource TemplatedParent}}"/>
  44. <Setter Property="Padding"
  45. Value="0"/>
  46. <Setter Property="Background"
  47. Value="{StaticResource GridViewColumnHeaderBorderBackground}"/>
  48. <Setter Property="Template">
  49. <Setter.Value>
  50. <ControlTemplate TargetType="{x:Type Thumb}">
  51. <Border Padding="{TemplateBinding Padding}"
  52. Background="Transparent">
  53. <Rectangle HorizontalAlignment="Center"
  54. Width="1"
  55. Fill="{TemplateBinding Background}"/>
  56. </Border>
  57. </ControlTemplate>
  58. </Setter.Value>
  59. </Setter>
  60. </Style>
Add Comment
Please, Sign In to add comment