Skip to content

FlowDirection change the validation style of textbox #11274

@alraseensaad

Description

@alraseensaad

Description

Validation style of textbox does not appear correct when set FlowDirection

<Grid
     Background="CadetBlue"
     Grid.Row="0">
     <Grid.ColumnDefinitions>
         <ColumnDefinition
             Width="*" />
         <ColumnDefinition
             Width="*" />
     </Grid.ColumnDefinitions>
     <StackPanel
         Margin="10 0"
         Grid.Row="0"
         Grid.Column="0">
         <TextBlock
             Margin="0,4"
             Text="Api url" />
         <TextBox
             FlowDirection="LeftToRight"
             Text="{Binding ApiUrl}" />
     </StackPanel>
     <StackPanel
         Margin="10 0" 
         Grid.Row="0"
         Grid.Column="2">
         <TextBlock
             Margin="0,4"
             Text="hub url" />
         <TextBox
             FlowDirection="LeftToRight"
             Text="{Binding HubUrl}" />
     </StackPanel>
 </Grid>
Image

Reproduction Steps

run the application with arabic culture

var culture = new CultureInfo("ar-Ye");


    Thread.CurrentThread.CurrentCulture = culture;
    Thread.CurrentThread.CurrentUICulture = culture;
    CultureInfo.DefaultThreadCurrentCulture = culture;
    CultureInfo.DefaultThreadCurrentUICulture = culture;


//Get the FlowDirection for current Culture
var flowDirection = CultureInfo.CurrentCulture.TextInfo.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;

//Set the FlowDirection for all controls
FrameworkElement.FlowDirectionProperty.OverrideMetadata(typeof(FrameworkElement), new
    FrameworkPropertyMetadata(flowDirection));

then set on textbox

  FlowDirection="LeftToRight"

Expected behavior

To be like

Image

Actual behavior

Image

Regression?

it happen in dotnet 10

Known Workarounds

No response

Impact

No response

Configuration

dotnet 10
windows 11 - default display language is English
x64

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions