-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathToolkitSampleOptionBaseAttribute.cs
More file actions
42 lines (36 loc) · 1.42 KB
/
ToolkitSampleOptionBaseAttribute.cs
File metadata and controls
42 lines (36 loc) · 1.42 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
// 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.Tooling.SampleGen.Attributes;
/// <summary>
/// Represents an abstraction of a sample option that the user can manipulate and the XAML can bind to.
/// </summary>
public abstract class ToolkitSampleOptionBaseAttribute : Attribute
{
/// <summary>
/// Creates a new instance of <see cref="ToolkitSampleOptionBaseAttribute"/>.
/// </summary>
/// <param name="bindingName">The name of the generated property, which you can bind to in XAML.</param>
/// <param name="defaultState">The initial value for the bound property.</param>
public ToolkitSampleOptionBaseAttribute(string bindingName, object? defaultState)
{
Name = bindingName;
DefaultState = defaultState;
}
/// <summary>
/// A name that you can bind to in your XAML.
/// </summary>
public string Name { get; internal set; }
/// <summary>
/// The default state.
/// </summary>
public object? DefaultState { get; }
/// <summary>
/// A title to display on top of the option.
/// </summary>
public string? Title { get; set; }
/// <summary>
/// The source generator-friendly type name used for casting.
/// </summary>
internal abstract string TypeName { get; }
}