Basically I have the following structure:
<Window ...
xmlns:my="http://schemas.company.com/WPF/Controls"
>
<Window.Resources>
<Style x:Key="MyStyle1" TargetType={x:Type TextBlock}>
...
</Style>
</Window.Resources>
<Grid x:Name="LayoutRoot">
<my:MyUserControl1 />
<my:MyUserControl1 />
<my:MyUserControl2 />
<my:MyUserControl2 />
</Grid>
</Window>
<UserControl ...
>
<TextBlock Style={ ?? What Goes Here ??} />
</UserControl>
How do I apply the style declared in the Window resources so that it goes to the UserControl that is being pulled from an external assembly?
If you want the Style to be applied to all
TextBlocks, including the ones inMyUserControl, just leave the x:Key out and it will be applied implictlyIf you want it to be set explicitly you can use
DynamicResourcein theUserControls