internal static FlowDirection ToFlowDirection(this EffectiveFlowDirection self) { if (self.IsLeftToRight()) { return(FlowDirection.LeftToRight); } else { return(FlowDirection.RightToLeft); } throw new InvalidOperationException($"Cannot convert {self} to {nameof(FlowDirection)}."); }
internal static NSTextAlignment ToNativeTextAlignment(this TextAlignment alignment, EffectiveFlowDirection flowDirection) { var isLtr = flowDirection.IsLeftToRight(); switch (alignment) { case TextAlignment.Center: return(NSTextAlignment.Center); case TextAlignment.End: if (isLtr) { return(NSTextAlignment.Right); } else { return(NSTextAlignment.Left); } default: if (isLtr) { return(NSTextAlignment.Left); } else { return(NSTextAlignment.Natural); } } }
internal static Windows.UI.Xaml.TextAlignment ToNativeTextAlignment(this TextAlignment alignment, EffectiveFlowDirection flowDirection = default(EffectiveFlowDirection)) { var isLtr = flowDirection.IsLeftToRight(); switch (alignment) { case TextAlignment.Center: return(Windows.UI.Xaml.TextAlignment.Center); case TextAlignment.End: if (isLtr) { return(Windows.UI.Xaml.TextAlignment.Right); } else { return(Windows.UI.Xaml.TextAlignment.Left); } default: if (isLtr) { return(Windows.UI.Xaml.TextAlignment.Left); } else { return(Windows.UI.Xaml.TextAlignment.Right); } } }
public static bool IsExplicit(this EffectiveFlowDirection self) { return((self & EffectiveFlowDirection.Explicit) == EffectiveFlowDirection.Explicit); }
public static bool IsLeftToRight(this EffectiveFlowDirection self) { return((self & EffectiveFlowDirection.RightToLeft) != EffectiveFlowDirection.RightToLeft); }