Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Custom & User Controls Sample #1786

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Zakariathr22
Copy link
Contributor

@Zakariathr22 Zakariathr22 commented Feb 25, 2025

Description

Added a new Custom & User Controls page with examples of both Custom Controls and UserControls to demonstrate reusable UI components. Main changes:

  • Added sample info to ControlInfoData.json.
  • Added Custom & User Controls Page.
  • Added sample controls.
  • Added sample code files.

Motivation and Context

This change provides a structured way to showcase both Custom Controls and UserControls helping developers understand their differences, implementation, and use cases.

Closes #1762

How Has This Been Tested?

Manually Tested

Screenshots (if appropriate):

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

xmlns:local="using:WinUIGallery.Samples.ControlPages.Fundamentals.Controls">

<!-- Style definition for CounterControl -->
<Style TargetType="local:CounterControl">
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe as a best practice, we could name this style and create a seperate style that does the overriding. That way a developer could use BasedOn

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this might be the best practice, but would it be simple for someone who just wants to learn the fundamentals?
I think the code is good as it is, especially since this is the approach used when creating a new custom control.
However, if you believe this should be included in the example, I'd be happy to implement it 😊

@Jay-o-Way
Copy link
Contributor

Maybe it's me, but I don't see a reason to create a new folder for the xaml files.

@Zakariathr22
Copy link
Contributor Author

Zakariathr22 commented Feb 25, 2025

I understand your point, and I have some concerns too.
Placing these items in the Samples/ControlPages folder might not be ideal, as they aren't actual pages.
Similarly, putting them in the Controls folder could be misleading, since they're not controls used by the app directly, they're intended as examples.

Maybe it's me, but I don't see a reason to create a new folder for the xaml files.

About this, I think adding them without organizing them into a specific folder could lead to a mess.

Edit:
I noticed that the Controls/DesignGuidance folder already contains example controls (like demonstrating brushes implementation). So, I think I’ll just create a Fundamentals folder there.
image

@Jay-o-Way
Copy link
Contributor

Have you thought of using the existing folder Fundamentals?

@Zakariathr22
Copy link
Contributor Author

Have you thought of using the existing folder Fundamentals?

Fundamentals folder is part of Samples/ControlPages folder, and as I said

Placing these items in the Samples/ControlPages folder might not be ideal, as they aren't actual pages.

@Zakariathr22 Zakariathr22 marked this pull request as ready for review February 26, 2025 18:03
@Zakariathr22
Copy link
Contributor Author

I decided to place the new controls in the fundamentals folder as suggested in this comment #1762 (comment)

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.

[Proposal] Add UserControl Page to the XAML Fundamentals Section
3 participants