I've got two stack panels nested within another stackpanel, the nested stack panels both have images in which need to be the same size, so I've used a style resorce. But this means duplicating the style resources in each stack panel. As shown;
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horiztonal">
<StackPanel.Resources>
<Style TargetType="Image">
<Setter Property="Width" Value="20"/>
</Style>
</StackPanel.Resources>
<Image />
<Image />
<Image />
<Image />
</StackPanel>
<StackPanel Orientation="Horiztonal">
<StackPanel.Resources>
<Style TargetType="Image">
<Setter Property="Width" Value="20"/>
</Style>
</StackPanel.Resources>
<Image />
<Image />
<Image />
<Image />
</StackPanel>
</StackPanel>
Is there a way to set this style on my surrounding stackpanel and have the children inherit that style, or would I be looking at making a style template (as shown; https://docs.microsoft.com/en-us/dotnet/framework/wpf/controls/styling-and-templating) and applying it individually to my images?