Cześć,
Mam problem ze stylem kontrolki TextBox.
Otóż stworzyłem taki styl:
<Style x:Name="LoginPageTextBox" TargetType="TextBox">
<Setter Property="FontWeight" Value="Light"/>
<Setter Property="Margin" Value="10"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Grid Background="#fafafa">
<ContentPresenter x:Name="HeaderContentPresenter" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Foreground="Black"/>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="Focused">
<VisualState.Setters>
<Setter Target="HeaderContentPresenter.Background" Value="Red"/>
<Setter Target="HeaderContentPresenter.Foreground" Value="Blue"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Do tej kontrolki:
<TextBox Background="Transparent" Foreground="Black"
PlaceholderText="ID" Style="{StaticResource LoginPageTextBox}"/>
Problem mam taki, że w momencie gdy klikam na kontrolkę TextBox(wywołuję stan Focused) i zacznę wpisywać tekst to on się nie pojawia. Co robię źle?
Rozumiem, że ContentPresenter to jest właśnie tekst, który wpisuję?