private void SetTextAndFontFamily(SymbolIconTag tag) { switch (tag.SymbolType) { case SymbolType.Glyph: if (!string.IsNullOrWhiteSpace(tag.FontFamily)) { this.FontFamily = new System.Windows.Media.FontFamily(tag.FontFamily); } else { this.FontFamily = new System.Windows.Media.FontFamily("Segoe MDL2 Assets"); } this.Text = this.GetUnicode(tag.SymbolName) ?? string.Empty; break; case SymbolType.Symbol: this.FontFamily = new System.Windows.Media.FontFamily("Segoe MDL2 Assets"); this.Text = KnownSymbols.ContainsKey(tag.SymbolName) ? KnownSymbols[tag.SymbolName] : string.Empty; break; case SymbolType.FontAwesome: this.FontFamily = new System.Windows.Media.FontFamily($"file:///{System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)}/SymbolVisualizer/FontAwesome.otf#FontAwesome"); this.Text = KnownFontAwesomeIcons.ContainsKey(tag.SymbolName) ? KnownFontAwesomeIcons[tag.SymbolName] : string.Empty; break; default: System.Diagnostics.Debugger.Break(); break; } }
public SymbolIconAdornment(SymbolIconTag tag) { this.SymbolTag = tag; this.Margin = new System.Windows.Thickness(4, 0, 4, 0); this.SetTextAndFontFamily(tag); }
internal void Update(SymbolIconTag dataTag) { this.SymbolTag = dataTag; this.SetTextAndFontFamily(dataTag); }