Hello,
I have a custom control, and want to derive a second control from that
control.
public class CustomButton : Button
{
}
public class SpecialCustomBu tton : CustomButton
{
}
I'd like to use the same base ControlTemplate for both controls, updating
the template used for the Content in the "special" control. However, I can't
seem to figure out how to "share" the ControlTemplate .
In CustomButton.ge neric.xaml, I define the template:
<ControlTemplat e x:Key="template CustomButton"
TargetType="{x: Type local:CustomBut ton}}">
<!-- Definitions Here -->
</ControlTemplate >
<Style TargetType="{x: Type local:CustomBut ton}">
<Setter Property="Templ ate"
Value="{StaticR esource templateCustomB utton}" />
</Style>
I try to reference the same control template in
SpecialCustomBu tton.generic.xa ml
<Style TargetType="{x: Type local:SpecialCu stomButton}">
<Setter Property="Templ ate"
Value="{Dynamic Resource templateCustomB utton}" />
</Style>
However, the special control never shows up on my panel.
Is there a way to do what I'm attempting to do, or do I have to create a new
ControlTemplate and bind every single property again?
Thanks.
WtS