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

Added EllipseDiameterScale (issue #2204) #2382

Merged
merged 1 commit into from
Feb 29, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions MahApps.Metro/Controls/ProgressRing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class ProgressRing : Control

public static readonly DependencyProperty EllipseOffsetProperty = DependencyProperty.Register("EllipseOffset", typeof(Thickness), typeof(ProgressRing), new PropertyMetadata(default(Thickness)));

public static readonly DependencyProperty EllipseDiameterScaleProperty = DependencyProperty.Register("EllipseDiameterScale", typeof(double), typeof(ProgressRing), new PropertyMetadata(1D));

private List<Action> _deferredActions = new List<Action>();

static ProgressRing()
Expand Down Expand Up @@ -65,6 +67,12 @@ public double EllipseDiameter
private set { SetValue(EllipseDiameterProperty, value); }
}

public double EllipseDiameterScale
{
get { return (double)GetValue(EllipseDiameterScaleProperty); }
set { SetValue(EllipseDiameterScaleProperty, value); }
}

public Thickness EllipseOffset
{
get { return (Thickness)GetValue(EllipseOffsetProperty); }
Expand Down Expand Up @@ -97,6 +105,7 @@ private static void BindableWidthCallback(DependencyObject dependencyObject, Dep

var action = new Action(() =>
{

ring.SetEllipseDiameter(
(double) dependencyPropertyChangedEventArgs.NewValue);
ring.SetEllipseOffset(
Expand All @@ -118,7 +127,7 @@ private void SetMaxSideLength(double width)

private void SetEllipseDiameter(double width)
{
EllipseDiameter = width / 8;
EllipseDiameter =(width / 8)*EllipseDiameterScale;
}

private void SetEllipseOffset(double width)
Expand Down Expand Up @@ -212,4 +221,4 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
throw new NotImplementedException();
}
}
}
}