diff --git a/common/CommunityToolkit.Labs.Core.SourceGenerators/Metadata/ToolkitSampleMetadata.cs b/common/CommunityToolkit.Labs.Core.SourceGenerators/Metadata/ToolkitSampleMetadata.cs index 55bec6b80..f6f8d829d 100644 --- a/common/CommunityToolkit.Labs.Core.SourceGenerators/Metadata/ToolkitSampleMetadata.cs +++ b/common/CommunityToolkit.Labs.Core.SourceGenerators/Metadata/ToolkitSampleMetadata.cs @@ -7,25 +7,60 @@ namespace CommunityToolkit.Labs.Core.SourceGenerators.Metadata; +//// We can't use record for WinUI 3 yet due to https://github.com/microsoft/microsoft-ui-xaml/issues/5315 + /// /// Contains the metadata needed to identify and display a toolkit sample. /// -/// A unique identifier for the sample, across all samples. -/// The display name for this sample page. -/// The description for this sample page. -/// A type that can be used to construct an instance of the sample control. -/// A factory method that returns a new instance of the control. -/// -/// The control type for the sample page's options pane. -/// Constructor should have exactly one parameter that can be assigned to the control type (). -/// -/// The generated sample options that were declared alongside this sample, if any. -public sealed record ToolkitSampleMetadata( - string Id, - string DisplayName, - string Description, - Type SampleControlType, - Func SampleControlFactory, - Type? SampleOptionsPaneType = null, - Func? SampleOptionsPaneFactory = null, - IEnumerable? GeneratedSampleOptions = null); +public sealed class ToolkitSampleMetadata +{ + public string Id { get; set; } + + public string DisplayName { get; set; } + + public string Description { get; set; } + + public Type SampleControlType { get; set; } + + public Func SampleControlFactory { get; set; } + + public Type? SampleOptionsPaneType { get; set; } + + public Func? SampleOptionsPaneFactory { get; set; } + + public IEnumerable? GeneratedSampleOptions { get; set; } + + /// + /// Contains the metadata needed to identify and display a toolkit sample. + /// + /// A unique identifier for the sample, across all samples. + /// The display name for this sample page. + /// The description for this sample page. + /// A type that can be used to construct an instance of the sample control. + /// A factory method that returns a new instance of the control. + /// + /// The (optional) control type for the sample page's options pane. + /// Constructor should have exactly one parameter that can be assigned to the control type (). + /// + /// A factory method that returns a new instance of the sample options control. + /// The generated sample options that were declared alongside this sample, if any. + public ToolkitSampleMetadata( + string id, + string displayName, + string description, + Type sampleControlType, + Func sampleControlFactory, + Type? sampleOptionsPaneType = null, + Func? sampleOptionsPaneFactory = null, + IEnumerable? generatedSampleOptions = null) + { + Id = id; + DisplayName = displayName; + Description = description; + SampleControlType = sampleControlType; + SampleControlFactory = sampleControlFactory; + SampleOptionsPaneType = sampleOptionsPaneType; + SampleOptionsPaneFactory = sampleOptionsPaneFactory; + GeneratedSampleOptions = generatedSampleOptions; + } +}