Ejemplo n.º 1
0
        /// <summary>Get the Unicode of an icon</summary>
        public static string GetUnicode(this EFontAwesomeIcon icon)
        {
            FontAwesomeInformationAttribute informationAttribute = icon.GetInformationAttribute <FontAwesomeInformationAttribute>();

            if (informationAttribute == null)
            {
                return(char.ConvertFromUtf32(0));
            }

            return(char.ConvertFromUtf32(informationAttribute.Unicode));
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            FontAwesomeInformationAttribute informationAttribute = (value as EFontAwesomeIcon?)?.GetInformationAttribute <FontAwesomeInformationAttribute>();

            if (informationAttribute == null)
            {
                return(null);
            }

            if (parameter is string format && !string.IsNullOrEmpty(format))
            {
                return(string.Format(format, informationAttribute.Label, informationAttribute.Style));
            }

            return(informationAttribute.Label);
        }
Ejemplo n.º 3
0
        /// <summary>Get the FontFamily of an icon</summary>
        public static FontFamily GetFontFamily(this EFontAwesomeIcon icon)
        {
            FontAwesomeInformationAttribute informationAttribute = icon.GetInformationAttribute <FontAwesomeInformationAttribute>();

            if (informationAttribute == null)
            {
                return(Fonts.RegularFontFamily);
            }

            switch (informationAttribute.Style)
            {
            case EFontAwesomeStyle.Solid:
                return(Fonts.SolidFontFamily);

            case EFontAwesomeStyle.Regular:
                return(Fonts.RegularFontFamily);

            case EFontAwesomeStyle.Brands:
                return(Fonts.BrandsFontFamily);

            default:
                return(null);
            }
        }
Ejemplo n.º 4
0
        /// <summary>Get the Typeface of an icon</summary>
        public static Typeface GetTypeFace(this EFontAwesomeIcon icon)
        {
            FontAwesomeInformationAttribute informationAttribute = icon.GetInformationAttribute <FontAwesomeInformationAttribute>();

            if (informationAttribute == null)
            {
                return(Fonts.RegularTypeface);
            }

            switch (informationAttribute.Style)
            {
            case EFontAwesomeStyle.Solid:
                return(Fonts.SolidTypeface);

            case EFontAwesomeStyle.Regular:
                return(Fonts.RegularTypeface);

            case EFontAwesomeStyle.Brands:
                return(Fonts.BrandsTypeface);

            default:
                return(null);
            }
        }
Ejemplo n.º 5
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            FontAwesomeInformationAttribute informationAttribute = (value as EFontAwesomeIcon?)?.GetInformationAttribute <FontAwesomeInformationAttribute>();

            return(informationAttribute?.Style ?? EFontAwesomeStyle.None);
        }
Ejemplo n.º 6
0
        /// <summary>Get the Font Awesome Style of an icon</summary>
        public static EFontAwesomeStyle GetStyle(this EFontAwesomeIcon icon)
        {
            FontAwesomeInformationAttribute informationAttribute = icon.GetInformationAttribute <FontAwesomeInformationAttribute>();

            return(informationAttribute?.Style ?? EFontAwesomeStyle.None);
        }