In my WPF application, I have added ItemControl and I set the background color in it. How do I set the parent background color only for child control without showing any background color in the parent? I have added a sample code and screen here.
<ItemsControl x:Name="MyItems" ItemsSource="{Binding Categories}" Background="Blue">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" VerticalAlignment="Top" Width="{Binding ElementName=Grid, Path=ActualWidth}" Margin="0,0,0,20"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Margin="10,10,10,10">
<Button Width="150" Height="120" HorizontalAlignment="Left" VerticalAlignment="Top" CommandParameter="{Binding CategoryId}" >
<TextBlock Text="{Binding CategoryName}" TextWrapping="Wrap" TextAlignment="Center" Margin="10"/>
</Button>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
[1]: https://i.stack.imgur.com/WiXGU.png