public object Convert(object value, Type targetType, object parameter, string language) { if (value != null) { var page = (Page)value; if (page != null) { if (page.Icon == null) { var glyph = (string)page.GetValue(AttachedFontIcon.GlyphProperty); if (!string.IsNullOrWhiteSpace(glyph)) { var familary = (string)page.GetValue(AttachedFontIcon.FontFamilyProperty); //control it's color by theme resource. //var color = (Color)page.GetValue(AttachedFontIcon.ColorProperty); var size = (double)page.GetValue(AttachedFontIcon.FontSizeProperty); var icon = new Windows.UI.Xaml.Controls.FontIcon() { Glyph = glyph, FontFamily = familary.ToFontFamily(), FontSize = size, //Foreground = color.ToBrush() }; return icon; } } else { var img = new Image(); img.Source = page.Icon; return img; } } } return null; }
public object Convert(object value, Type targetType, object parameter, string language) { if (value != null) { var page = (Page)value; if (page != null) { if (page.Icon == null) { var glyph = (string)page.GetValue(AttachedFontIcon.GlyphProperty); if (!string.IsNullOrWhiteSpace(glyph)) { var familary = (string)page.GetValue(AttachedFontIcon.FontFamilyProperty); //control it's color by theme resource. //var color = (Color)page.GetValue(AttachedFontIcon.ColorProperty); var size = (double)page.GetValue(AttachedFontIcon.FontSizeProperty); var icon = new Windows.UI.Xaml.Controls.FontIcon() { Glyph = glyph, FontFamily = familary.ToFontFamily(), FontSize = size, //Foreground = color.ToBrush() }; return(icon); } } else { var img = new Image(); img.Source = page.Icon; return(img); } } } return(null); }