Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 17th, 2012  |  syntax: None  |  size: 0.99 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How do I bind template with style?
  2. <ControlTemplate x:Key="RoundedButtonTemplate" TargetType="{x:Type MyProject:ImageButton}">
  3.         <Grid>
  4.             <Border x:Name="border" Background="WHAT DO I PUT HERE?" CornerRadius="10"/>
  5.         </Grid>        
  6.     </ControlTemplate>
  7.        
  8. <Style x:Key="GreenButtonStyle" TargetType="{x:Type MyProject:ImageButton}">
  9.         <Setter Property="Background" Value="{DynamicResource GreenButtonBrush}"/>
  10. RoundedButtonTemplate}"/>
  11.     </Style>
  12.        
  13. <Style x:Key="GreenButtonStyle" TargetType="{x:Type MyProject:ImageButton}">
  14.         <Setter Property="Background" Value="{DynamicResource BlueButtonBrush}"/>
  15. RoundedButtonTemplate}"/>
  16.     </Style>
  17.        
  18. <local:ImageButton HorizontalAlignment="Left" Margin="24,19.234,0,20" Width="97" Grid.Row="3" Style="{DynamicResource GreenButtonStyle}" Template="{DynamicResource RoundedButtonTemplate}"/>
  19.        
  20. <Setter Property="Template" Value="{DynamicResource RoundedButtonTemplate}"/>
  21.        
  22. Background="{TemplateBinding Background}"