wpf keep base style in custom control

Posted by Archana R on Stack Overflow See other posts from Stack Overflow or by Archana R
Published on 2010-04-28T11:17:28Z Indexed on 2010/04/28 11:23 UTC
Read the original article Hit count: 298

Filed under:
|
|

Hello,

I have created a custom button as i wanted an image and a text inside it as follows:

<Style TargetType="{x:Type Local:ImageButton}">
     <Setter Property="Template">
         <Setter.Value>
             <ControlTemplate TargetType="{x:Type Local:ImageButton}">
                  <StackPanel Height="Auto" Orientation="Horizontal">
                       <Image Margin="0,0,3,0" Source="{TemplateBinding ImageSource}"/>
                       <TextBlock Text="{TemplateBinding Content}" /> 
                   </StackPanel>
             </ControlTemplate>
          </Setter.Value>
     </Setter>
</Style>

Here, ImageButton is a class which inherits from Button class and has ImageSource as a dependency property.

But i want to keep the look and feel of the original button. How can i do it? Thanks.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about style