I do WPF for a living. I have the Control Development book. In the part about creating custom controls, ALL the xaml from the template is used in the examples. I want to create subclass of a combox box. I don't need the XAML for the button or the textbox, or any other part except for the content site. If you go look at the XAML in the link I provided, I want to replace this:
Something like this
public class MyComboBox : ComboBox
{
static MyComboBox()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(MyComboBox),
new FrameworkPropertyMetadata(typeof(MyComboBox)));
}
// Add DP's \* logic here
}
and
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
</ControlTemplate>
</Setter.Value>
</Setter>
If I do this XAML, the ENTIRE template is replaced, so I'd have to recreate the textbox, button, etc. What I'm asking is, instead of replacing the ENTIRE TEMPLATE, can I somehow replace just a small piece of that template?
In theory, theory and practice are the same. But in practice, they never are.” If it's not broken, fix it until it is. Everything makes sense in someone's mind.