File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Microsoft.Toolkit.Uwp.UI/Extensions/Markup Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the MIT license.
3+ // See the LICENSE file in the project root for more information.
4+
5+ using System ;
6+ using Windows . UI . Xaml . Controls ;
7+ using Windows . UI . Xaml . Markup ;
8+
9+ namespace Microsoft . Toolkit . Uwp . UI . Extensions
10+ {
11+ /// <summary>
12+ /// Custom <see cref="MarkupExtension"/> which can provide <see cref="BitmapIconSource"/> values.
13+ /// </summary>
14+ [ MarkupExtensionReturnType ( ReturnType = typeof ( BitmapIconSource ) ) ]
15+ public sealed class BitmapIconSourceExtension : MarkupExtension
16+ {
17+ /// <summary>
18+ /// Gets or sets the <see cref="Uri"/> representing the image to display.
19+ /// </summary>
20+ public Uri Source { get ; set ; }
21+
22+ /// <summary>
23+ /// Gets or sets a value indicating whether to display the icon as monochrome.
24+ /// </summary>
25+ public bool ShowAsMonochrome { get ; set ; }
26+
27+ /// <inheritdoc/>
28+ protected override object ProvideValue ( )
29+ {
30+ return new BitmapIconSource
31+ {
32+ ShowAsMonochrome = ShowAsMonochrome ,
33+ UriSource = Source
34+ } ;
35+ }
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments