I'm having a problem when changing a flow direction in a usercontrol by code, it changes all controls flowdirection.
How do i avoid some of thouse controls of changing flowdirection, maintaining allways LTR flowdirection.
Best Regards
-
1As is customary (almost obligatory) on this website, please provide a small working code example that demonstrates your problem. Had you done that originally, then you would most likely have had a solution or two provided for you by now.Sheridan– Sheridan2014年05月09日 13:43:51 +00:00Commented May 9, 2014 at 13:43
1 Answer 1
You can declare default style in your resource for each and every control, so that it gets applied to respective control by default in you user control.
the xaml code is:
<Window.Resources>
<Style x:Key="TextBoxTemplate" TargetType="{x:Type TextBox}">
<Setter Property="FlowDirection" Value="RightToLeft"/>
</Style>
</Window.Resources>
the code behind is:
public void Init_Style()
{
Style style = this.FindResource("TextBoxTemplate") as Style;
textBox1.Style = style;
}
In this way you can avoid changes of all controls flow direction.
Sign up to request clarification or add additional context in comments.
Comments
lang-cs