2
comportement
I définir un style en app.xaml:étrange HorizontalContentAlignment (non)
<Style x:Key="textBoxCenter" TargetType="{x:Type TextBox}">
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
J'utilise le style en Window1.xaml:
<TextBox
Style="{StaticResource textBoxCenter}"
Background="BlanchedAlmond" Text="BobbleHead" />
<TextBox
Style="{StaticResource textBoxCenter}"
Background="AliceBlue" Text="WhammyBar" />
Cependant, l'alignement horizontal, à la fois dans le Designer et à l'exécution, est 'Left', même si la barre d'outils Properties indique qu'il est 'Center'.
Merci, je pensais HorizontalContentAlignment était la propriété que je avais besoin. – Number8