Reputation: 176
I am working on RTL in xamarin forms. I need to show Right to left flow direction on click of a button. I was working from morning. I didn't get the solution. I got only language changes means if I want Arabic I can do by using multilingual plugin. But I need to change the flow direction. How to do it?
Upvotes: 1
Views: 711
Reputation: 477
In Android Manifest file, enable RTL like below
<application android:label="MyApp" android:supportsRtl="true">
<!--others-->
</application>
Note that RTL is available in android from API 17+
In the iOS project, enable Arabic culture by adding it to the CFBundleLocalizations in info.plist file-
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>ar</string>
</array>
In the Forms project, set flow direction (by default it is Right oriented) to ContentPage, Labels etc.
FlowDirection="{x:Static Device.FlowDirection}"
Setting Arabic culture will automatically change the page's Flow direction to RightToLeft if it's specified like above.
Upvotes: 0
Reputation: 7189
You just need to set the FlowDirection
in your page / visual elements.
<ContentPage ... FlowDirection="{x:Static Device.FlowDirection}"> />
Or, if you don't want to set based on the device language, you can just set one of these available options
public enum FlowDirection
{
MatchParent = 0,
LeftToRight = 1,
RightToLeft = 2,
}
You can read more in the Official Documentation
Upvotes: 1