code_junkie

How do I provide two default templates for a Custom Control in WPF

Nov 13th, 2011
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}"> ...
  2.  
  3. <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}"> ...
  4.  
  5. <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
  6. <Style.Triggers>
  7. <Trigger Property="Orientation" Value="Horizontal">
  8. <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
  9. </Trigger>
  10. <Trigger Property="Orientation" Value="Vertical">
  11. <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
  12. </Trigger>
  13. </Style.Triggers>
  14. </Style>
Add Comment
Please, Sign In to add comment