Mina Wissa
Mina Wissa

Reputation: 10971

Xamarin Forms Content Page: Change flow direction to Right to Left?

how can I change the flow direction of a Xamarin Forms Content Page from Left to Right to Right to Left? something like Windows Phone Flow Direction property?

Upvotes: 4

Views: 3569

Answers (5)

Ziyad Godil
Ziyad Godil

Reputation: 2680

Try latest In latest Xamarin forms 3.0.0

If you’re making apps that support right-to-left languages, we have great news for you: Xamarin.Forms 3.0 makes it easier than ever to flip layouts to match language direction!

When supporting languages such as Arabic and Hebrew that flow right-to-left, you may now tap into the very easy to use FlowDirection property on any VisualElement instead of using platform-specifics or effects as you may have used previously. Because you already know the direction the device prefers by accessing Device.FlowDirection, updating your UI could be as easy as adding this to the head of your page in XAML:

FlowDirection="{x:Static Device.FlowDirection}"

For more information about updating your applications to support right-to-left layouts:

Right-To-Left Localization in Xamarin.Forms Blog

Upvotes: 0

Steve Chadbourne
Steve Chadbourne

Reputation: 6953

It might be worth mentioning that the Grial UI Kit product has just added RTL support.

enter image description here

More details here

Upvotes: 1

whd.nsr
whd.nsr

Reputation: 694

it's 2017 and Xamarin forms does not support RTL yet..

Upvotes: 1

Mina Wissa
Mina Wissa

Reputation: 10971

@Hodor thanks, there is no support for such a thing (at least at this time). a workaround for this when using list views is to create multiple list item templates with LTR/RTL directions and use them accordin g to the current UI culture.

Another workaround for other controls is to implement a renderer for each control type and change its HorizontalOptions or XAlignment according to the UI culture.

Upvotes: 2

Hodor
Hodor

Reputation: 166

You mean the navigation flow?

Usually left => right means adding a page on the navigation stack and right => left means removing it.

You can extend a navigation controller on the "native" C# code and make custom animations. There are many ways to do that. Here's an example in MonoTouch

public partial class ScreenController : UINavigationController
{
     private Page currentPage = null;

             private void setCurrentPage(Page p)
    {
        currentPage = p;
        //Using present View Controller: will set the current page to root.
        PresentViewController(new UINavigationController(currentPage.CreateViewController())
                            {
                                ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal,
                            }, true, null);

        //Using custom animation
        PushControllerWithTransition(this, currentPage.CreateViewController(), UIViewAnimationOptions.TransitionFlipFromLeft);
    }

    public static void PushControllerWithTransition(this UINavigationController target, UIViewController controllerToPush,
        UIViewAnimationOptions transition)
    {
        UIView.Transition(target.View, 0.75d, transition, delegate()
        {
            target.PushViewController(controllerToPush, false);
        }, null);
    }
}

Upvotes: -1

Related Questions