Reputation: 3834
How to set value for multi-property value in Style for TextBox
in Windows Phone 8.1?
TextBox
XAML:
<TextBox Style="{StaticResource MyTextBoxInputText}" Template= "{StaticResource MyTextBox}">
<TextBox.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFEFEFEF"/>
<GradientStop Color="White" Offset="1"/>
<GradientStop Color="White" Offset="0.1"/>
</LinearGradientBrush>
</TextBox.Background>
</TextBox>
Style
XAML:
<Style x:Key="MyTextBoxInputText" TargetType="TextBox">
<Setter Property="FontSize" Value="18"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Height" Value="40"/>
<Setter Property="MinHeight" Value="30"/>
</Style>
How to specify LinearGradientBrush
property of TextBox
in Style MyTextBoxInputText
?
Upvotes: 0
Views: 175
Reputation: 39006
Like this.
<Style x:Key="MyTextBoxInputText" TargetType="TextBox">
<Setter Property="FontSize" Value="18"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Height" Value="40"/>
<Setter Property="MinHeight" Value="30"/>
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFEFEFEF"/>
<GradientStop Color="White" Offset="1"/>
<GradientStop Color="White" Offset="0.1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Style>
Upvotes: 1