- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.4k
FontIcon markup extension #3110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
            michael-hawker
  merged 64 commits into
  CommunityToolkit:master
from
Sergio0694:feature/font-icon-extension
  
      
      
   
  May 16, 2020 
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            64 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      3057376
              
                Added FontIcon markup extension
              
              
                Sergio0694 728f1ce
              
                Removed unnecessary using directives
              
              
                Sergio0694 800efba
              
                Renamed the FontIcon markup extension
              
              
                Sergio0694 c2f00be
              
                Added FontIcon tests
              
              
                Sergio0694 4493ffc
              
                Fixed a typo in the test XAML
              
              
                Sergio0694 6418ba5
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                michael-hawker e8d4309
              
                Update UnitTests/Extensions/Test_FontIconExtensionMarkupExtension.cs
              
              
                Sergio0694 6638416
              
                Update UnitTests/Extensions/Test_FontIconExtensionMarkupExtension.cs
              
              
                Sergio0694 452a276
              
                Update UnitTests/Extensions/Test_FontIconExtensionMarkupExtension.cs
              
              
                Sergio0694 5577118
              
                Added new FontIcon properties
              
              
                Sergio0694 9018d88
              
                Merge branch 'feature/font-icon-extension' of https://github.com/Serg…
              
              
                Sergio0694 870306c
              
                Added more tests for the new properties
              
              
                Sergio0694 c6d6023
              
                Added FontIconSourceExtension
              
              
                Sergio0694 e90b0eb
              
                Added BitmapIconExtension
              
              
                Sergio0694 8dda65e
              
                Merge branch 'master' into feature/bitmap-icon-extension
              
              
                Sergio0694 cea30df
              
                Merge branch 'master' into feature/font-icon-source-extension
              
              
                Sergio0694 1b34996
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                Sergio0694 23dcec0
              
                Merge branch 'master' into feature/bitmap-icon-extension
              
              
                Sergio0694 63c2b6e
              
                Merge branch 'master' into feature/font-icon-source-extension
              
              
                Sergio0694 96b22d4
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                Sergio0694 7d6f9ec
              
                Merge branch 'master' into feature/bitmap-icon-extension
              
              
                Sergio0694 91947c1
              
                Merge branch 'master' into feature/font-icon-source-extension
              
              
                Sergio0694 0d8f538
              
                Added tests for the FontIconSource extension
              
              
                Sergio0694 1af9349
              
                Fixed namespace for BitmapIconExtension type
              
              
                Sergio0694 bdcfd9a
              
                Added tests for BitmapIconExtension type
              
              
                Sergio0694 88844c1
              
                Merge branch 'master' into feature/bitmap-icon-extension
              
              
                Sergio0694 d0421d8
              
                Merge branch 'master' into feature/font-icon-source-extension
              
              
                Sergio0694 1d9ad41
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                Sergio0694 ae5f94b
              
                Merge pull request #14 from Sergio0694/feature/font-icon-source-exten…
              
              
                Sergio0694 76cfed2
              
                Merge branch 'feature/font-icon-extension' into feature/bitmap-icon-e…
              
              
                Sergio0694 3618cc2
              
                Merge pull request #15 from Sergio0694/feature/bitmap-icon-extension
              
              
                Sergio0694 993cdef
              
                Removed [Bindable] attribute from markup extensions
              
              
                Sergio0694 329a5bd
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                Sergio0694 0d57964
              
                Added a sample page for the FontIconExtension type
              
              
                Sergio0694 ede72e4
              
                Added sample for the BitmapIcon extension
              
              
                Sergio0694 b783070
              
                Added FontIconSource sample page (not loading)
              
              
                Sergio0694 bf098a6
              
                Minor code style tweaks, also tests work now ¯\_(ツ)_/¯
              
              
                Sergio0694 843a442
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                Sergio0694 117c8f9
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                Sergio0694 246a41d
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                azchohfi bf6a306
              
                Added shallow copy for icon markup extensions
              
              
                Sergio0694 83e538a
              
                Fixed a missing resource in the icon markup sample page
              
              
                Sergio0694 1a524b6
              
                Code refactoring
              
              
                Sergio0694 d706a40
              
                Updated samples page
              
              
                Sergio0694 0925cf1
              
                Code refactoring, minor optimizations
              
              
                Sergio0694 69e5687
              
                Added SymbolIconSourceExtension type
              
              
                Sergio0694 fecdc53
              
                Added SymbolIconSourceExtension sample
              
              
                Sergio0694 3f4a5c8
              
                Added foreground property to icon extensions
              
              
                Sergio0694 26c4ec3
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                Sergio0694 a44d3b4
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                Sergio0694 e6ca30d
              
                Fixed a typo in a unit test
              
              
                Sergio0694 dae5a49
              
                Fixed remaining unit tests
              
              
                Sergio0694 22392d2
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                Sergio0694 24d8a10
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                michael-hawker 875dfd3
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                michael-hawker 78f4d76
              
                Removed unnecessary using directives
              
              
                Sergio0694 db20516
              
                Fixed BitmapIcon and FontIcon extension tests
              
              
                Sergio0694 364ea74
              
                Fixed FontIconSource extension tests
              
              
                Sergio0694 c27aa22
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                Sergio0694 5110f5b
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                Sergio0694 48481f1
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                Sergio0694 d9f0395
              
                Merge remote-tracking branch 'upstream/master' into feature/font-icon…
              
              
                Sergio0694 3e80c64
              
                Fixed build errors after merge
              
              
                Sergio0694 6dd7056
              
                Merge branch 'master' into feature/font-icon-extension
              
              
                Sergio0694 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            34 changes: 34 additions & 0 deletions
          
          34 
        
  Microsoft.Toolkit.Uwp.SampleApp/SamplePages/IconExtensions/IconExtensionsPage.xaml
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.IconExtensionsPage" | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| xmlns:ex="using:Microsoft.Toolkit.Uwp.UI.Extensions" | ||
| mc:Ignorable="d"> | ||
| <Grid> | ||
| <StackPanel> | ||
|  | ||
| <CommandBar> | ||
| <AppBarButton Icon="{ex:FontIcon Glyph=}"/> | ||
| <AppBarButton Icon="{ex:SymbolIcon Glyph=Play}"/> | ||
| </CommandBar> | ||
|  | ||
| <SwipeControl> | ||
| <SwipeControl.LeftItems> | ||
| <SwipeItems Mode="Reveal"> | ||
| <SwipeItem Text="Accept" IconSource="{ex:FontIconSource Glyph=}"/> | ||
| <SwipeItem Text="Play" IconSource="{ex:SymbolIconSource Glyph=Play}"/> | ||
| </SwipeItems> | ||
| </SwipeControl.LeftItems> | ||
| </SwipeControl> | ||
|  | ||
| <Button> | ||
| <Button.Flyout> | ||
| <MenuFlyout> | ||
| <MenuFlyoutItem Icon="{ex:BitmapIcon Source=/Assets/ToolkitLogo.png}" /> | ||
| </MenuFlyout> | ||
| </Button.Flyout> | ||
| </Button> | ||
| </StackPanel> | ||
| </Grid> | ||
| </Page> | ||
        
          
          
            30 changes: 30 additions & 0 deletions
          
          30 
        
  Microsoft.Toolkit.Uwp.SampleApp/SamplePages/IconExtensions/IconExtensionsPage.xaml.cs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|  | ||
| using System.Linq; | ||
| using Microsoft.Toolkit.Uwp.UI.Animations.Behaviors; | ||
| using Microsoft.Toolkit.Uwp.UI.Extensions; | ||
| using Microsoft.Xaml.Interactivity; | ||
| using Windows.UI.Xaml; | ||
|  | ||
| namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages | ||
| { | ||
| /// <summary> | ||
| /// A page that shows how to use the offset behavior. | ||
| /// </summary> | ||
| public sealed partial class IconExtensionsPage : IXamlRenderListener | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="IconExtensionsPage"/> class. | ||
| /// </summary> | ||
| public IconExtensionsPage() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
|  | ||
| public void OnXamlRendered(FrameworkElement control) | ||
| { | ||
| } | ||
| } | ||
| } | 
        
          
          
            86 changes: 86 additions & 0 deletions
          
          86 
        
  Microsoft.Toolkit.Uwp.SampleApp/SamplePages/IconExtensions/IconExtensionsXaml.bind
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| <Page | ||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages.IconExtensionsPage" | ||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| xmlns:ex="using:Microsoft.Toolkit.Uwp.UI.Extensions" | ||
| mc:Ignorable="d"> | ||
| <Grid> | ||
| <StackPanel Spacing="8" | ||
| HorizontalAlignment="Center" | ||
| VerticalAlignment="Center"> | ||
|  | ||
| <TextBlock Text="Use the FontIcon extension to create FontIcon items from custom glyphs." | ||
| TextWrapping="Wrap" | ||
| Style="{StaticResource BodyTextBlockStyle}"/> | ||
|  | ||
| <CommandBar> | ||
| <AppBarButton Icon="{ex:FontIcon Glyph=}"/> | ||
| <AppBarButton Icon="{ex:FontIcon Glyph=}"/> | ||
| <AppBarButton Icon="{ex:FontIcon Glyph=}"/> | ||
| </CommandBar> | ||
|  | ||
| <TextBlock Text="Use the SymbolIcon extension to create FontIcon items from known symbols." | ||
| TextWrapping="Wrap" | ||
| Style="{StaticResource BodyTextBlockStyle}"/> | ||
|  | ||
| <CommandBar> | ||
| <AppBarButton Icon="{ex:SymbolIcon Glyph=Play}"/> | ||
| <AppBarButton Icon="{ex:SymbolIcon Glyph=Pause}"/> | ||
| <AppBarButton Icon="{ex:SymbolIcon Glyph=Home}"/> | ||
| </CommandBar> | ||
|  | ||
| <TextBlock Text="Use the FontIconSource extension to create FontIconSource items from custom glyphs." | ||
| TextWrapping="Wrap" | ||
| Style="{StaticResource BodyTextBlockStyle}"/> | ||
|  | ||
| <SwipeControl BorderThickness="1" | ||
| Background="#40000000" | ||
| Width="300" Margin="12" Height="68"> | ||
| <SwipeControl.LeftItems> | ||
| <SwipeItems Mode="Reveal"> | ||
| <SwipeItem Text="Accept" IconSource="{ex:FontIconSource Glyph=}"/> | ||
| <SwipeItem Text="Flag" IconSource="{ex:FontIconSource Glyph=}"/> | ||
| </SwipeItems> | ||
| </SwipeControl.LeftItems> | ||
| <TextBlock Text="Swipe Right" | ||
| Margin="12" | ||
| HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
| </SwipeControl> | ||
|  | ||
| <TextBlock Text="Use the SymbolIconSource extension to create FontIconSource items from known symbols." | ||
| TextWrapping="Wrap" | ||
| Style="{StaticResource BodyTextBlockStyle}"/> | ||
|  | ||
| <SwipeControl BorderThickness="1" | ||
| Background="#40000000" | ||
| Width="300" Margin="12" Height="68"> | ||
| <SwipeControl.LeftItems> | ||
| <SwipeItems Mode="Reveal"> | ||
| <SwipeItem Text="Accept" IconSource="{ex:FontIconSource Glyph=Accept}"/> | ||
| <SwipeItem Text="Flag" IconSource="{ex:FontIconSource Glyph=Flag}"/> | ||
| </SwipeItems> | ||
| </SwipeControl.LeftItems> | ||
| <TextBlock Text="Swipe Right" | ||
| Margin="12" | ||
| HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
| </SwipeControl> | ||
|  | ||
| <TextBlock Text="Use the BitmapIcon extension to create BitmapIcon items from images." | ||
| TextWrapping="Wrap" | ||
| Style="{StaticResource BodyTextBlockStyle}"/> | ||
|  | ||
| <Button Content="Click me!"> | ||
| <Button.Flyout> | ||
| <MenuFlyout> | ||
| <MenuFlyoutItem Text="Toolkit app" | ||
| Icon="{ex:BitmapIcon Source=/Assets/ToolkitLogo.png}" /> | ||
| <MenuFlyoutItem Text="Microsoft" | ||
| Icon="{ex:BitmapIcon Source=/Assets/mslogo.png}" /> | ||
| </MenuFlyout> | ||
| </Button.Flyout> | ||
| </Button> | ||
| </StackPanel> | ||
| </Grid> | ||
| </Page> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            58 changes: 58 additions & 0 deletions
          
          58 
        
  Microsoft.Toolkit.Uwp.UI/Extensions/Markup/Abstract/TextIconExtension.cs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|  | ||
| using System; | ||
| using Windows.UI.Text; | ||
| using Windows.UI.Xaml.Markup; | ||
| using Windows.UI.Xaml.Media; | ||
|  | ||
| namespace Microsoft.Toolkit.Uwp.UI.Extensions | ||
| { | ||
| /// <summary> | ||
| /// An abstract <see cref="MarkupExtension"/> which to produce text-based icons. | ||
| /// </summary> | ||
| public abstract class TextIconExtension : MarkupExtension | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the size of the icon to display. | ||
| /// </summary> | ||
| public double FontSize { get; set; } | ||
|  | ||
| [ThreadStatic] | ||
| private static FontFamily segoeMDL2AssetsFontFamily; | ||
|  | ||
| /// <summary> | ||
| /// Gets the reusable "Segoe MDL2 Assets" <see cref="FontFamily"/> instance. | ||
| /// </summary> | ||
| protected static FontFamily SegoeMDL2AssetsFontFamily | ||
| { | ||
| get => segoeMDL2AssetsFontFamily ??= new FontFamily("Segoe MDL2 Assets"); | ||
| } | ||
|  | ||
| /// <summary> | ||
| /// Gets or sets the thickness of the icon glyph. | ||
| /// </summary> | ||
| public FontWeight FontWeight { get; set; } = FontWeights.Normal; | ||
|  | ||
| /// <summary> | ||
| /// Gets or sets the font style for the icon glyph. | ||
| /// </summary> | ||
| public FontStyle FontStyle { get; set; } = FontStyle.Normal; | ||
|  | ||
| /// <summary> | ||
| /// Gets or sets the foreground <see cref="Brush"/> for the icon. | ||
| /// </summary> | ||
| public Brush Foreground { get; set; } | ||
|  | ||
| /// <summary> | ||
| /// Gets or sets a value indicating whether automatic text enlargement, to reflect the system text size setting, is enabled. | ||
| /// </summary> | ||
| public bool IsTextScaleFactorEnabled { get; set; } | ||
|  | ||
| /// <summary> | ||
| /// Gets or sets a value indicating whether the icon is mirrored when the flow direction is right to left. | ||
| /// </summary> | ||
| public bool MirroredWhenRightToLeft { get; set; } | ||
| } | ||
| } | 
        
          
          
            20 changes: 20 additions & 0 deletions
          
          20 
        
  Microsoft.Toolkit.Uwp.UI/Extensions/Markup/Abstract/TextIconExtension{T}.cs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|  | ||
| using Windows.UI.Xaml.Markup; | ||
|  | ||
| namespace Microsoft.Toolkit.Uwp.UI.Extensions | ||
| { | ||
| /// <summary> | ||
| /// An abstract <see cref="MarkupExtension"/> which to produce text-based icons. | ||
| /// </summary> | ||
| /// <typeparam name="T">The type representing the glyph for the current icon.</typeparam> | ||
| public abstract class TextIconExtension<T> : TextIconExtension | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the <typeparamref name="T"/> value representing the icon to display. | ||
| /// </summary> | ||
| public T Glyph { get; set; } | ||
| } | ||
| } | 
        
          
          
            37 changes: 37 additions & 0 deletions
          
          37 
        
  Microsoft.Toolkit.Uwp.UI/Extensions/Markup/BitmapIconExtension.cs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|  | ||
| using System; | ||
| using Windows.UI.Xaml.Controls; | ||
| using Windows.UI.Xaml.Markup; | ||
|  | ||
| namespace Microsoft.Toolkit.Uwp.UI.Extensions | ||
| { | ||
| /// <summary> | ||
| /// Custom <see cref="MarkupExtension"/> which can provide <see cref="BitmapIcon"/> values. | ||
| /// </summary> | ||
| [MarkupExtensionReturnType(ReturnType = typeof(BitmapIcon))] | ||
| public sealed class BitmapIconExtension : MarkupExtension | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the <see cref="Uri"/> representing the image to display. | ||
| /// </summary> | ||
| public Uri Source { get; set; } | ||
|  | ||
| /// <summary> | ||
| /// Gets or sets a value indicating whether to display the icon as monochrome. | ||
| /// </summary> | ||
| public bool ShowAsMonochrome { get; set; } | ||
|  | ||
| /// <inheritdoc/> | ||
| protected override object ProvideValue() | ||
| { | ||
| return new BitmapIcon | ||
| { | ||
| ShowAsMonochrome = ShowAsMonochrome, | ||
| UriSource = Source | ||
| }; | ||
| } | ||
| } | ||
| } | 
        
          
          
            48 changes: 48 additions & 0 deletions
          
          48 
        
  Microsoft.Toolkit.Uwp.UI/Extensions/Markup/FontIconExtension.cs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|  | ||
| using Windows.UI.Xaml.Controls; | ||
| using Windows.UI.Xaml.Markup; | ||
| using Windows.UI.Xaml.Media; | ||
|  | ||
| namespace Microsoft.Toolkit.Uwp.UI.Extensions | ||
| { | ||
| /// <summary> | ||
| /// Custom <see cref="MarkupExtension"/> which can provide <see cref="FontIcon"/> values. | ||
| /// </summary> | ||
| [MarkupExtensionReturnType(ReturnType = typeof(FontIcon))] | ||
| public class FontIconExtension : TextIconExtension<string> | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets the font family to use to display the icon. If <see langword="null"/>, "Segoe MDL2 Assets" will be used. | ||
| /// </summary> | ||
| public FontFamily FontFamily { get; set; } | ||
|  | ||
| /// <inheritdoc/> | ||
| protected override object ProvideValue() | ||
| { | ||
| var fontIcon = new FontIcon | ||
| { | ||
| Glyph = Glyph, | ||
| FontFamily = FontFamily ?? SegoeMDL2AssetsFontFamily, | ||
| FontWeight = FontWeight, | ||
| FontStyle = FontStyle, | ||
| IsTextScaleFactorEnabled = IsTextScaleFactorEnabled, | ||
| MirroredWhenRightToLeft = MirroredWhenRightToLeft | ||
| }; | ||
|  | ||
| if (FontSize > 0) | ||
| { | ||
| fontIcon.FontSize = FontSize; | ||
| } | ||
|  | ||
| if (Foreground != null) | ||
| { | ||
| fontIcon.Foreground = Foreground; | ||
| } | ||
|  | ||
| return fontIcon; | ||
| } | ||
| } | ||
| } | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.