-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy pathBitmapIconExtension.cs
More file actions
32 lines (28 loc) · 1022 Bytes
/
BitmapIconExtension.cs
File metadata and controls
32 lines (28 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// 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.
namespace CommunityToolkit.WinUI;
/// <summary>
/// Custom <see cref="MarkupExtension"/> which can provide <see cref="BitmapIcon"/> values.
/// </summary>
[MarkupExtensionReturnType(ReturnType = typeof(BitmapIcon))]
public sealed partial 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
};
}
}