/// <summary> /// Returns a new <see cref="PathIcon"/> using the path associated with the provided <see cref="FluentSymbol"/>. /// </summary> public static PathIcon GetPathIcon(FluentSymbol symbol) { return(new PathIcon { Data = (Geometry)Windows.UI.Xaml.Markup.XamlBindingHelper.ConvertValue(typeof(Geometry), GetPathData(symbol)), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }); }
public void TestFluentSymbolUsesLocaleRules() { var lt = new MessageContext("lt"); var us = new MessageContext(new string[] { "en-US", "en" }); var one = new FluentSymbol("one"); var few = new FluentSymbol("few"); var many = new FluentSymbol("many"); var other = new FluentSymbol("other"); var num1 = new FluentNumber("1"); var num11 = new FluentNumber("11"); var num2 = new FluentNumber("2"); var num0_6 = new FluentNumber("0.6"); one.Match(lt, num1).Should().BeTrue(); one.Match(lt, num11).Should().BeFalse(); one.Match(lt, num2).Should().BeFalse(); one.Match(lt, num0_6).Should().BeFalse(); one.Match(us, num1).Should().BeTrue(); one.Match(us, num11).Should().BeFalse(); one.Match(us, num2).Should().BeFalse(); one.Match(us, num0_6).Should().BeFalse(); few.Match(lt, num1).Should().BeFalse(); few.Match(lt, num11).Should().BeFalse(); few.Match(lt, num2).Should().BeTrue(); few.Match(lt, num0_6).Should().BeFalse(); few.Match(us, num1).Should().BeFalse(); few.Match(us, num11).Should().BeFalse(); few.Match(us, num2).Should().BeFalse(); few.Match(us, num0_6).Should().BeFalse(); many.Match(lt, num1).Should().BeFalse(); many.Match(lt, num11).Should().BeFalse(); many.Match(lt, num2).Should().BeFalse(); many.Match(lt, num0_6).Should().BeTrue(); many.Match(us, num1).Should().BeFalse(); many.Match(us, num11).Should().BeFalse(); many.Match(us, num2).Should().BeFalse(); many.Match(us, num0_6).Should().BeFalse(); other.Match(lt, num1).Should().BeFalse(); other.Match(lt, num11).Should().BeTrue(); other.Match(lt, num2).Should().BeFalse(); other.Match(lt, num0_6).Should().BeFalse(); other.Match(lt, num1).Should().BeFalse(); other.Match(us, num11).Should().BeTrue(); other.Match(us, num2).Should().BeTrue(); other.Match(us, num0_6).Should().BeTrue(); }
/// <summary> /// Returns a new <see cref="Geometry"/> using the path associated with the provided <see cref="int"/>. /// </summary> public static Geometry GetPathData(FluentSymbol symbol) { if (AllFluentIcons.TryGetValue(symbol, out string pathData)) { return((Geometry)Windows.UI.Xaml.Markup.XamlBindingHelper.ConvertValue(typeof(Geometry), pathData)); } else { return(null); } }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); if (this.GetTemplateChild("IconDisplay") is PathIcon pi) { this.iconDisplay = pi; // Awkward workaround for a weird bug where iconDisplay is null // when OnSymbolChanged fires in a newly created FluentSymbolIcon Symbol = Symbol; } }
public void TestFluentSymbol() { var symbol = new FluentSymbol("sym"); var ctx = new MessageContext("en-US"); symbol.Format(ctx).Should().Be("sym"); symbol.Match(ctx, new FluentSymbol("sym")).Should().BeTrue(); symbol.Match(ctx, new FluentSymbol("notsym")).Should().BeFalse(); symbol.Match(ctx, "sym").Should().BeTrue(); symbol.Match(ctx, "notsym").Should().BeFalse(); symbol.Match(ctx, new FluentString("sym")).Should().BeTrue(); symbol.Match(ctx, new FluentString("notsym")).Should().BeFalse(); symbol.Match(ctx, 442).Should().BeFalse(); }
/// <summary> /// Constructs a <see cref="FluentIconElement"/> displaying the specified symbol. /// </summary> /// <param name="symbol"></param> public FluentIconElement(FluentSymbol symbol) { Symbol = symbol; }
/// <summary> /// Constructs an <see cref="IconSource"/> that uses a Fluent System Icon as its content. /// </summary> public FluentIconSource(FluentSymbol symbol) { Symbol = symbol; }
/// <summary> /// Constructs a <see cref="FluentSymbolIcon"/> with the specified symbol. /// </summary> public FluentSymbolIcon(FluentSymbol symbol) { this.DefaultStyleKey = typeof(FluentSymbolIcon); Symbol = symbol; }