Xamarin表单内容页面:将流向更改为从右向左?

问题描述:

如何将Xamarin Forms内容页面的流向从左向右更改为右向左?像Windows Phone流动方向属性?Xamarin表单内容页面:将流向更改为从右向左?

@霍多尔谢谢,没有支持这样的事情(至少在这个时候)。在使用列表视图时的一个解决方法是创建多个带有LTR/RTL方向的列表项模板,并根据当前UI文化使用它们。

其他控件的另一个解决方法是为每个控件类型实现一个渲染器,并根据UI文化更改其Horizo​​ntalOptions或XAlignment。

+0

您好,如何为每个控件编写一个用于rtl支持的渲染器?你能给我一个样品吗?这个选项可以用于android,IOS和Windows手机吗? – 2016-08-06 20:54:40

+0

嗨,请查看本指南:https://developer.xamarin.com/guides/xamarin-forms/custom-renderer/祝你好运 – 2016-08-06 21:19:39

你的意思是导航流?

通常left => right意味着在导航堆栈中添加一个页面,right => left意味着删除它。

您可以在“本机”C#代码上扩展导航控制器并制作自定义动画。有很多方法可以做到这一点。这里有一个例子在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); 
    } 
} 
+0

谢谢,但我的意思的布局方向,RTL或LTR。是否可以像我们在Windows Phone SDK中那样改变它? – 2014-09-25 09:24:35

+1

我不这么认为。您可以在布局上更改的唯一方向是在垂直和水平之间。 – Hodor 2014-09-25 19:18:07

这是2017年和Xamarin形式不支持RTL尚未..

这可能是值得一提的是,Grial PR酒店UI套件产品刚刚加入RTL支持。

enter image description here

More details here