I have a custom control that is really just there for type-specific template selection:
public class MyControl : Control { }
I then have a template that is auto-applied:
<Style TargetType="MyControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MyControl">
<Path Data="..." Fill="{TemplateBinding Foreground}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
That works fine, I can drop a into the XAML and it shows properly.
My problem is trying to get the Foreground to show correctly when this is in a content presenter. Consider the following content presenter:
<ContentPresenter Control.Foreground="Red" Content="This Works"/>
The text shown is red. But if I make the content be a "MyControl", it doesn't - it goes up the visual tree looking for a foreground to inherit. It seems to ignore Control.Foreground. How do I get my custom control to pay attention to Control.Foreground on the content presenter?
In case it matters, this content presenter is in a control template for a TabItem, trying to get one of these "MyControl" instances to be used as a the header of the TabItem.