I tried the two methods explained in this existing answer, but neither of them is working. How can I set the background colour?
Method 1
<UserControl x:Class="deletewpf.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:deletewpf"
mc:Ignorable="d"
d:DesignStyle="{StaticResource MyDesignStyle}"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<Style TargetType="{x:Type Control}" x:Key="MyDesignStyle">
<Setter Property="Background" Value="White"/>
</Style>
</UserControl.Resources>
<Grid>
</Grid>
</UserControl>
Method 2
<UserControl x:Class="deletewpf.UserControl2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:deletewpf"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<d:DesignerProperties.DesignStyle>
<Style TargetType="UserControl">
<Setter Property="Background" Value="White"/>
</Style>
</d:DesignerProperties.DesignStyle>
<Grid>
</Grid>
</UserControl>
I had pressed Run to build it before getting those errors.