How to Customize Expander Control RRS feed

  • Question

  • Hi,

    Well, three hours left, and I still can't find how to extend expander control.

    My problem is the following:

    I want to extend expander control. I'd like to have basic functionality + my. I've created public class CustomExpander : Expander, and added two Dependency Properties: StatusImage and StatusName.

    Well, I'll say that with adding additional properties we are done. Now the main part is to add Style into the Generic.xaml file. and use my properties there.

    Instead of default code:


     <Style TargetType="{x:Type local:CustomExpander}">
      <Setter Property="Template">
        <ControlTemplate TargetType="{x:Type local:CustomExpander}">
         <Border Background="{TemplateBinding Background}"
           BorderBrush="{TemplateBinding BorderBrush}"
           BorderThickness="{TemplateBinding BorderThickness}">

    I need to add Expander style and add to that style my properties to extend Expander functionality.


    The question IS: Which exactly style I need to copy-paste there ???

    thank you guys in advance,

    Wednesday, August 25, 2010 3:56 PM