Beispiel #1
0
 public static void MSLabel(this UILabel self, MSFontWeight fontWeight, MSFontStyle style = MSFontStyle.L, UIColor textColor = null)
 {
     if (textColor == null)
     {
         textColor = UIColorMS.NeutralPrimary;
     }
     self.Font      = UIFontMS.FromStyle(style, fontWeight);
     self.TextColor = textColor;
 }
 public static UIFont FromStyle(MSFontStyle style, MSFontWeight weight)
 {
     if (UIDevice.CurrentDevice.CheckSystemVersion(8, 2))
     {
         return(UIFont.SystemFontOfSize(MSFontConstants.FontSize(style), MSFontConstants.FontWeight(weight)));
     }
     else
     {
         return(UIFont.SystemFontOfSize(MSFontConstants.FontSize(style)));
     }
 }
        internal static UIFontWeight FontWeight(MSFontWeight weight)
        {
            switch (weight)
            {
            case MSFontWeight.Light:
                return(UIFontWeight.Thin);

            case MSFontWeight.SemiLight:
                return(UIFontWeight.Light);

            case MSFontWeight.Regular:
                return(UIFontWeight.Regular);

            case MSFontWeight.Semibold:
                return(UIFontWeight.Semibold);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }