Skip to content

Commit

Permalink
Edit circular progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
dogzz9445 committed Jun 17, 2024
1 parent f649d9d commit 917bdaa
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,7 @@
</PathGeometry>
</Path.Data>
</Path>
<Border Width="100"
Height="100">
<TextBlock Foreground="Gray"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Path=Value, StringFormat={}%{0},
RelativeSource={RelativeSource TemplatedParent}}"
FontSize="{TemplateBinding FontSize}" />
</Border>
</Canvas>

</ControlTemplate>
</Setter.Value>
</Setter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
using System.Windows.Media.Animation;
using System.Windows;
using System.Windows.Media;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace Corathing.UI.WPF.Controls.CircularProgressBars;

public partial class CircularProgressBar : ProgressBar
public partial class CircularProgressBar : ProgressBar, INotifyPropertyChanged
{
#region Public Properties
public static readonly DependencyProperty SweepDirectionProperty =
Expand Down Expand Up @@ -96,15 +98,51 @@ public double InnerThickness

#endregion

#region INotifyPropertyChanged
public event PropertyChangedEventHandler? PropertyChanged;

public void RaisePropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

//public void SetProperty<T>(ref T )
#endregion


#region Internal Properties
public Point StartPoint { get; internal set; }
public double Diameter { get; internal set; }
public Thickness HighlightStrokeMargin { get; internal set; }
public Size HighlightSize { get; internal set; }
public Thickness ShadowStorkeMargin { get; internal set; }
public double OuterRadius { get; internal set; }
public double MidRadius { get; internal set; }
public double InnerRadius { get; internal set; }
// https://stackoverflow.com/questions/33015016/hidden-public-property-in-wpf-control

public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register(
nameof(StartPoint),
typeof(Point),
typeof(CircularProgressBar),
new PropertyMetadata(new Point(0, 0)));

[Browsable(false)]
public Point StartPoint
{
get => (Point)GetValue(StartPointProperty);
set => SetValue(StartPointProperty, value);
}

public static readonly DependencyProperty DiameterProperty = DependencyProperty.Register(
nameof(Diameter),
typeof(double),
typeof(CircularProgressBar),
new PropertyMetadata(0.0));

public double Diameter
{
get;
set;
}
public Thickness HighlightStrokeMargin { get; set; }
public Size HighlightSize { get; set; }
public Thickness ShadowStorkeMargin { get; set; }
public double OuterRadius { get; set; }
public double MidRadius { get; set; }
public double InnerRadius { get; set; }

#endregion

Expand Down

0 comments on commit 917bdaa

Please sign in to comment.