Question: I have an external style resource in a resource dictionary I'm referencing with x:Key. It has an x:TargetType specifying a target (TextBlock). Is it possible to apply this to a control containing a TextBlock and have all TextBlock elements within that control have the style applied?

Thanks,
Robert

Answer: 
The easiest way to do that would be to define a Style within the Control that is based on your external style resource, but don't specify an x:Key, just the TargetType.

```
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource SomeOtherStyle}">

```

Without a key, it'll apply itself to all TextBlocks within the control.
I think this is what you are looking for:

Your custom user control "test":

```
<UserControl x:Class="WpfApplication4.test"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="300" Width="300">
    <Grid>
        <TextBlock>test</TextBlock>
    </Grid>
</UserControl>

```

Your Styles document "Res/Styles.xaml"

```
 <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type TextBlock}">
    <Style.Setters>
        <Setter Property="Foreground" Value="Blue" />
    </Style.Setters>
</Style>

```

Your main window or parent:

```
<Window x:Class="WpfApplication4.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:uc="clr-namespace:WpfApplication4"
Title="Window1" Height="300" Width="300">
<Window.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Res/Styles.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Window.Resources>

<Grid>
    <uc:test></uc:test>
</Grid>

```

The textblock in the custom control "test" now displays with a blue foreground.