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

New shape samples #1132

Merged
merged 5 commits into from
Dec 15, 2022
Merged

Conversation

gregwoo-microsoft
Copy link
Contributor

New samples to show how to create various shapes including:

  • Ellipses
  • Rectangles
  • Polygons
  • Lines
  • Polylines
  • Paths
  • Geometry groups

Note: This work is in progress

Description

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

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)

@gregwoo-microsoft
Copy link
Contributor Author

@chingucoding let me know what you think. Note: this is still a work in progress but I'd love to get your early feedback. For instance, I think it would make more sense to break up those samples into multiple pages (e.g. Shapes, Lines, Paths). Also, I couldn't figure out how to bind a Polygon's point X/Y coordinate to a slider value. Let me know if you know how to do that, otherwise, I'll have another look at it next week.

@marcelwgn
Copy link
Collaborator

I think separating them out would be a good idea, maybe they should get their own "Shapes" section where we give Rectangle, Line, ... all their own page?

Regarding polygon point X/Y, the only way to change them it seems is through point animations (https://learn.microsoft.com/uwp/api/windows.foundation.point?view=winrt-22621&WT.mc_id=WDIT-MVP-5004239#animating-point-values) but even them I'm not entirely sure it will work. If I remember correctly, some of these APIs take a snapshot of the points and after that, when the entries such as points get modified they don't take effect. But maybe I would still try out the point animations if we want to change the points position.

@gregwoo-microsoft
Copy link
Contributor Author

@chingucoding I separated the samples into 2 pages: 1st page for shapes (rectangle, ellipse, polygon) and a 2nd page for lines (line, polyline, path, geometry group). I put those 2 pages into the "Styles" subsection. Let me know what you think.

Comment on lines 27 to 43
//private void List_GotFocus(object sender, RoutedEventArgs e)
//{
// //Control1.StartBringIntoView();
//}

//private void createNewWindow_Click(object sender, RoutedEventArgs e)
//{
// var newWindow = WindowHelper.CreateWindow();
// var rootPage = new NavigationRootPage();
// rootPage.RequestedTheme = ThemeHelper.RootTheme;
// newWindow.Content = rootPage;
// newWindow.Activate();

// var targetPageType = typeof(NewControlsPage);
// string targetPageArguments = string.Empty;
// rootPage.Navigate(targetPageType, targetPageArguments);
//}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be removed.

Comment on lines 27 to 43
//private void List_GotFocus(object sender, RoutedEventArgs e)
//{
// //Control1.StartBringIntoView();
//}

//private void createNewWindow_Click(object sender, RoutedEventArgs e)
//{
// var newWindow = WindowHelper.CreateWindow();
// var rootPage = new NavigationRootPage();
// rootPage.RequestedTheme = ThemeHelper.RootTheme;
// newWindow.Content = rootPage;
// newWindow.Activate();

// var targetPageType = typeof(NewControlsPage);
// string targetPageArguments = string.Empty;
// rootPage.Navigate(targetPageType, targetPageArguments);
//}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be deleted.

Comment on lines 34 to 41
<Slider x:Name="lineSlider1" Header="Point #1 X" Minimum="0" Maximum="100"
StepFrequency="0.5" SmallChange="1" IsFocusEngagementEnabled="False"/>
<Slider x:Name="lineSlider2" Header="Point #1 Y" Minimum="0" Maximum="100"
StepFrequency="0.5" SmallChange="1" IsFocusEngagementEnabled="False"/>
<Slider x:Name="lineSlider3" Header="Point #2 X" Minimum="200" Maximum="300"
StepFrequency="0.5" SmallChange="1" IsFocusEngagementEnabled="False"/>
<Slider x:Name="lineSlider4" Header="Point #2 Y" Minimum="0" Maximum="100"
StepFrequency="0.5" SmallChange="1" IsFocusEngagementEnabled="False"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about naming those "Startpoint X, Startpoint Y,..."?

Comment on lines 96 to 97
&lt;Polyline Stroke="Black" StrokeThickness="$(Slider1)"
Points="10,100 60,40 200,40 250,100"/&gt;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Formatting

WinUIGallery/ControlPages/LinePage.xaml Show resolved Hide resolved
Comment on lines 137 to 138
&lt;Path Stroke="DarkGoldenRod" StrokeThickness="$(Slider1)"
Data="M 10,100 C 100,25 300,250 400,75 H 200"/&gt;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: formatting

Comment on lines 87 to 89
&lt;Rectangle Fill="SteelBlue" Height="$(Slider1)" Width="$(Slider2)"
Stroke="Black" StrokeThickness="$(Slider3)"
RadiusY="$(Slider4)" RadiusX="$(Slider5)"/&gt;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: formatting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chingucoding is it just a question of adding a tab for the 2nd and 3rd lines or is there something else?

Comment on lines 134 to 135
&lt;Polygon Fill="SteelBlue" Points="10,100 60,40 200,40 250,100"
StrokeThickness="$(Slider1)" Stroke="Black"/&gt;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: formatting

"ImagePath": "ms-appx:///Assets/ControlImages/CreateMultipleWindows.png",
"ImageIconPath": "ms-appx:///Assets/ControlIcons/DefaultIcon.png",
"Description": "Draws a straight line between two points.",
"Content": "<p>Look at the <i>LinePage.xaml</i> file in Visual Studio to see the full code for this page.</p>",
"IsNew": false,
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about marking this as new?

"Description": "Apply custom colors to your controls through this cascading API, or scope them to a local subset.",
"Content": "",
"Description": "Basic shapes are intended for decorative rendering or for compositing non-interactive parts of controls.",
"Content": "<p>Look at the <i>ShapePage.xaml</i> file in Visual Studio to see the full code for this page.</p>",
"IsNew": false,
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about marking this as new?

@marcelwgn
Copy link
Collaborator

Left a few comments, mostly small things. I really like the new samples, especially the idea of having a toggle to show the points the polyline/polygon is made of.

@gregwoo-microsoft
Copy link
Contributor Author

@chingucoding I implemented the changes you suggested. Let me know if you think that there is something else to add/modify 😄

Copy link
Collaborator

@marcelwgn marcelwgn left a comment

Choose a reason for hiding this comment

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

LGTM, really great that we also showcase these APIs now!

@gregwoo-microsoft
Copy link
Contributor Author

The only things missing are the 2 control icons, I'll work with our design team to get those.

@gregwoo-microsoft gregwoo-microsoft merged commit 28faf21 into microsoft:main Dec 15, 2022
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.

None yet

2 participants