Materialdesigninxamltoolkit: How to set TextAlignment of the materialDesign:HintAssist.Hint

Created on 4 Aug 2020  路  2Comments  路  Source: MaterialDesignInXAML/MaterialDesignInXamlToolkit

I have TextBox with the MaterialDesignOutlinedTextFieldTextBox styles. Now I want to align text in the center of TextBox, But I can't find any option in materialDesign:HintAssist to align hint text.
Please help me, what can I do?

question

Most helpful comment

Currently not supported. But you can override the property like this.

            <TextBox Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}"
                     TextAlignment="Center"
                     materialDesign:HintAssist.Hint="Hint Text">
                <TextBox.Resources>
                    <Style TargetType="{x:Type materialDesign:SmartHint}">
                        <Setter Property="HorizontalAlignment" Value="Center"/>
                    </Style>
                </TextBox.Resources>
            </TextBox>

All 2 comments

Currently not supported. But you can override the property like this.

            <TextBox Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}"
                     TextAlignment="Center"
                     materialDesign:HintAssist.Hint="Hint Text">
                <TextBox.Resources>
                    <Style TargetType="{x:Type materialDesign:SmartHint}">
                        <Setter Property="HorizontalAlignment" Value="Center"/>
                    </Style>
                </TextBox.Resources>
            </TextBox>

Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bebenins picture bebenins  路  3Comments

MoshiMoshi0 picture MoshiMoshi0  路  4Comments

boskokg picture boskokg  路  3Comments

mgnslndh picture mgnslndh  路  4Comments

cmeeren picture cmeeren  路  4Comments