Skip to content

Conversation

AnthroHeader
Copy link
Contributor

Added a radial progress bar control, as described in issue #827

@dnfclas
Copy link

dnfclas commented Jan 24, 2017

Hi @albertofustinoni, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. I promise there's no faxing. https://cla2.dotnetfoundation.org.

TTYL, DNFBOT;

@dnfclas
Copy link

dnfclas commented Jan 24, 2017

@albertofustinoni, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR.

Thanks, DNFBOT;

@deltakosh deltakosh added this to the v1.4 milestone Jan 24, 2017
{
this.DefaultStyleKey = typeof(RadialProgressBar);

Foreground = Application.Current.Resources[DefaultForegroundColorBrushName] as SolidColorBrush;
Copy link
Contributor

Choose a reason for hiding this comment

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

These should not be set in code - should be set in your generic XAML definition so that it can be properly styled. For example:

<Setter Property="Foreground" Value="{StaticResourse SystemControlHighlightAccentBrush}" />

<ControlTemplate TargetType="local:RadialProgressBar">
<Grid>
<!-- Gray outline of progress bar -->
<Path Fill="Transparent" Stroke="{TemplateBinding Background}" StrokeThickness="{TemplateBinding Thickness}" StrokeDashCap="Flat">
Copy link
Contributor

Choose a reason for hiding this comment

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

Typically you wouldn't use "Background" as the track background here, you'd create a separate DependencyProperty for it. As odd as it may be, Background should be template bound to the grid above this, and set as Transparent by default imo.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed

},
{
"Name": "RadialProgressBar",
"Type": "RadialProgressBarPage",
Copy link
Contributor

Choose a reason for hiding this comment

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

Getting

private const string DefaultForegroundColorBrushName = "SystemControlHighlightAccentBrush";
private const string DefaultBackgroundColorBrushName = "SystemControlBackgroundBaseLowBrush";

private PathFigure OutlineFigure { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

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

These should be private fields, not properties

/// <summary>
/// Identifies the Thickness dependency property
/// </summary>
public static readonly DependencyProperty ThicknessProperty = DependencyProperty.Register("Thickness", typeof(double), typeof(RadialProgressBar), new PropertyMetadata(4.0, ThicknessChangedHandler));
Copy link
Contributor

Choose a reason for hiding this comment

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

Use nameof() instead a string for "Thickness".

/// </summary>
public RadialProgressBar()
{
this.DefaultStyleKey = typeof(RadialProgressBar);
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove usages of "this."

<ControlTemplate TargetType="local:RadialProgressBar">
<Grid>
<!-- Gray outline of progress bar -->
<Path Fill="Transparent" Stroke="{TemplateBinding Background}" StrokeThickness="{TemplateBinding Thickness}" StrokeDashCap="Flat">
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed

@AnthroHeader
Copy link
Contributor Author

Addressed points raised so far

@AnthroHeader
Copy link
Contributor Author

Question: what is supposed to happen with this PR? After fixing the issues that were raised I heard nothing...

@deltakosh
Copy link
Contributor

Hey we will merge it but as we are closing 1.3 now I delayed this one for 1.4
But no worry we will merge it

@AnthroHeader
Copy link
Contributor Author

Got it, thank you.

@AnthroHeader
Copy link
Contributor Author

I don't think it's a design requirement form Microsoft, this is my opinion as a user and developer.

Visual consistency has always been an issue on Windows: I think a semi-official toolkit like this should try to be part of the solution instead of adding to the problem.

@deltakosh
Copy link
Contributor

hello what is the status of this PR? Do we want to merge it with loading control? Close it?

@AnthroHeader
Copy link
Contributor Author

I would like to know as well

@hermitdave
Copy link
Contributor

@deltakosh we should leave the merging with Loading control as a next step. We can have just the progress control and include this as an option in loading control for 2.0 ?

@hermitdave
Copy link
Contributor

@albertofustinoni can you please fix the .md file to use xml rather than XAML ?

@deltakosh
Copy link
Contributor

@pedrolamas can you update your review?

@pedrolamas
Copy link
Member

Everything looks good to me! 😄

@AnthroHeader
Copy link
Contributor Author

@hermitdave If you mean in docs\controls\RadialProgressBar.md, it should be already changed to xml

@hermitdave
Copy link
Contributor

@albertofustinoni my bad!

@deltakosh
Copy link
Contributor

I like this control but what about an attached property to a progessBar? it is almost the same behavior. Only visual change. I assume a restyling is not enough but perhaps with an attached property?

@skendrot just told me that you can inherit from ProgressBar. which could be even better

@hermitdave
Copy link
Contributor

Deriving it from ProgressBar isn't a bad idea..

@deltakosh deltakosh modified the milestones: v1.5, v1.4 Mar 20, 2017
@ToxicAdder
Copy link

PR creator here, posting from my alt.

RadialProgressBar now inherits from ProgressBar. I have also synced with changes in upstream.

Copy link
Contributor

@nmetulev nmetulev left a comment

Choose a reason for hiding this comment

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

Looks good to me

/// <summary>
/// Identifies the Outline dependency property
/// </summary>
public static readonly DependencyProperty OutlineProperty = DependencyProperty.Register(nameof(Outline), typeof(Brush), typeof(RadialProgressBar), new PropertyMetadata(new SolidColorBrush(Windows.UI.Colors.Transparent)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to use the same property names as ProgressBar for the Background color? In other words, wondering if this property is needed?

Maximum="100"
Width="@[Width:Slider:100:100-200]"
Height="@[Height:Slider:100:100-200]"/>
</Grid>
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to also add the Color enum for the Outline(Background) and Foreground so the show up as properties?

@nmetulev
Copy link
Contributor

@albertofustinoni , what do you think about my comments?

@AnthroHeader
Copy link
Contributor Author

I considered using the Background property to color the circular outline instead of creating a new dependency property, but doing so would mean that the actual background (rectangular pane containing the control) color could not be changed.

To me, this seemed inconsistent with other controls, so I didn't go for it. Do you think doing so would be better?

@AnthroHeader
Copy link
Contributor Author

@nmetulev as for adding colors to properties in the samples app, other controls didn't do it, so I didn't either.

@nmetulev
Copy link
Contributor

Makes sense having the outline property, but in that case, we should have it as a property on the sample page so it can be discovered more easily.

@nmetulev
Copy link
Contributor

Look at the SlidableListItem for an example of using the color enum in the sample app

@igorissen
Copy link

It'll be nice to have also the possibility to change the direction of the progress. I can't help and make a pull request because I'm learning C#/XAML for UWP development.

@nmetulev nmetulev merged commit fb2b942 into CommunityToolkit:dev Apr 24, 2017
@nmetulev
Copy link
Contributor

@igorissen , that's a great suggestion, could you open a user voice entry to see if there is a larger need for this from the rest of the community?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet