I want to create some styles in Window.Resources. Below is the code I tried, but it does not work:
<Window.Resources> <Style x:Key="StyleOne" TargetType="{x:Type Control}"> <Setter Property="Control.Background" Value="Blue"></Setter> <Setter Property="Control.Height" Value="20"></Setter> </Style> <Style x:Key="StyleTwo" BasedOn="{StaticResource StyleOne}"> <Setter Property="Control.Background" Value="Red"></Setter> <Setter Property="Control.Height" Value="20"></Setter> </Style> </Window.Resources> <Button Style="{StaticResource StyleOne}"></Button> <Button Style="{StaticResource StyleTwo}"></Button>
It gives an error message:
The Content property is set more than once.
Abbas source share