项目作者: danielkatz

项目描述 :
A polyfill for FlowDirection aware Margin
高级语言: C#
项目地址: git://github.com/danielkatz/RtlThickness.git
创建时间: 2018-07-10T21:25:18Z
项目社区:https://github.com/danielkatz/RtlThickness

开源协议:

下载


RtlThickness

A simple polyfill for FlowDirection aware Margin on Xamarin.Forms 3.1

Currently, Xamarin Forms 3.1 has an inconsistent support for FlowDirection in Thickness typed properties; While Padding respects the element’s FlowDirection, Margin does not.
(see Issue 3066)

How to use

To use the FlowDirection aware Margin, just add BiDi.cs to your project and replace all Margin to BiDi.Margin in XAML.
All the magic happens in BiDi.cs.

For example:

  1. <ContentView BackgroundColor="Red">
  2. <ContentView Margin="50,10,100,10" BackgroundColor="White">
  3. <Label>Margin="50,10,100,10"</Label>
  4. </ContentView>
  5. </ContentView>

Should become:

  1. <ContentView BackgroundColor="Red">
  2. <ContentView local:BiDi.Margin="50,10,100,10" BackgroundColor="White">
  3. <Label>Margin="50,10,100,10"</Label>
  4. </ContentView>
  5. </ContentView>

Done!

When the issue will be resolved just switch back to the regular Margin.