-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathBooleanExtension.cs
More file actions
42 lines (38 loc) · 1.4 KB
/
BooleanExtension.cs
File metadata and controls
42 lines (38 loc) · 1.4 KB
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
33
34
35
36
37
38
39
40
41
42
using System.Windows.Markup;
namespace BytecodeApi.Wpf.Markup;
/// <summary>
/// Implements <see cref="bool" /> support for .NET Framework XAML Services.
/// </summary>
[MarkupExtensionReturnType(typeof(bool))]
public sealed class BooleanExtension : MarkupExtension
{
/// <summary>
/// Gets or sets the <see cref="bool" /> value for this extension.
/// </summary>
public bool Value { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="BooleanExtension" /> class.
/// </summary>
public BooleanExtension()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="BooleanExtension" /> class, initializing <see cref="Value" /> based on the provided <see cref="bool" /> value.
/// </summary>
/// <param name="value">A <see cref="bool" /> value that is assigned to <see cref="Value" />.</param>
public BooleanExtension(bool value) : this()
{
Value = value;
}
/// <summary>
/// Returns a <see cref="bool" /> value that is supplied in the constructor of <see cref="BooleanExtension" />.
/// </summary>
/// <param name="serviceProvider">Object that can provide services for the markup extension.</param>
/// <returns>
/// A <see cref="bool" /> value that is supplied in the constructor of <see cref="BooleanExtension" />.
/// </returns>
public override object ProvideValue(IServiceProvider serviceProvider)
{
return Value;
}
}