AKP
AKP

Reputation: 15

Wrong displayed of file name with underscore in RTL in WPF

I am trying to display a file name "123_xyz.wmv" in a TextBlock in WPF I have set the FlowDirection="RightToLeft" the file is displayed xyz.wmv_123 which is not correct. Please advice.

Upvotes: 1

Views: 156

Answers (1)

evanb
evanb

Reputation: 3101

Special characters will separate text in a right to left order and that is why you see the filename as such. In order to get around this, you will need to enclose the filename in a Run and specify the FlowDirection as LeftToRight. Basically it would be like this:

<TextBlock FlowDirection="RightToLeft">Filename: <Run FlowDirection="LeftToRight">123_xyz.wmv</Run></TextBlock>

Take a look at this link for further info. Go down to the FlowDocument section.

Upvotes: 2

Related Questions