Skip to content

Restructure samples#2167

Merged
marcelwgn merged 4 commits into
microsoft:mainfrom
marcelwgn:restructure
May 16, 2026
Merged

Restructure samples#2167
marcelwgn merged 4 commits into
microsoft:mainfrom
marcelwgn:restructure

Conversation

@marcelwgn
Copy link
Copy Markdown
Contributor

@marcelwgn marcelwgn commented May 14, 2026

This is a draft to garner feedback before we fully convert one example to so AI can convert the rest

We are introducing a new SampleCodePath property on ControlExample that loads both XAML and C# code snippets from a single file using a simple section-based format:

 --- xaml
 <Button Content="Click me" />
 --- c#
 private void OnClick() { }

Sections are identified by --- followed by the type (xaml or c#). They can appear in any order, and either may be omitted.

Folder restructuring:

  • Moved ButtonPage + its sample code into Samples/Button/ to have a per-control folder pattern
  • Moved Data, SampleHelpers, and SamplePages from Samples/ into a new SampleSupport/ root folder to separate support files from actual sample pages

Namespaces are unchanged - only physical file locations and MSBuild/runtime path references were updated.

Future direction: The --- type marker format is designed to be extensible. In a future change, metadata like title and description could also be inlined in the same file (e.g. --- title, --- description), allowing a single file to fully describe a control example (except the code needed for setup of course)

@marcelwgn marcelwgn requested review from lei9444 and niels9001 May 14, 2026 06:31
set { SetValue(CSharpSourceProperty, value); }
}

public static readonly DependencyProperty SampleCodePathProperty = DependencyProperty.Register("SampleCodePath", typeof(string), typeof(ControlExample), new PropertyMetadata(null, OnSampleCodePathChanged));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: nameof() instead of string.

@marcelwgn marcelwgn marked this pull request as ready for review May 15, 2026 17:32
@marcelwgn marcelwgn enabled auto-merge (squash) May 16, 2026 10:12
@marcelwgn
Copy link
Copy Markdown
Contributor Author

/azp run

@marcelwgn marcelwgn merged commit 765036f into microsoft:main May 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants