-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcircularProgressBar.xaml.cs
More file actions
100 lines (85 loc) · 3.42 KB
/
circularProgressBar.xaml.cs
File metadata and controls
100 lines (85 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
namespace TestUsers
{
/// <summary>
/// Логика взаимодействия для circularProgressBar.xaml
/// </summary>
public partial class circularProgressBar : UserControl
{
public circularProgressBar()
{
InitializeComponent();
}
public Brush IndicatorBrush
{
get { return (Brush)GetValue(IndicatorBrushProperty); }
set { SetValue(IndicatorBrushProperty, value); }
}
public static readonly DependencyProperty IndicatorBrushProperty =
DependencyProperty.Register("IndicatorBrush", typeof(Brush), typeof(circularProgressBar));
public Brush BackgroundBrush
{
get { return (Brush)GetValue(BackgroundBrushProperty); }
set { SetValue(BackgroundBrushProperty, value); }
}
public static readonly DependencyProperty BackgroundBrushProperty =
DependencyProperty.Register("BackgroundBrush", typeof(Brush), typeof(circularProgressBar));
public int ArcThickness
{
get { return (int)GetValue(ArcThicknessProperty); }
set { SetValue(ArcThicknessProperty, value); }
}
public static readonly DependencyProperty ArcThicknessProperty =
DependencyProperty.Register("ArcThickness", typeof(int), typeof(circularProgressBar));
public int PercentFontSize
{
get { return (int)GetValue(PercentFontSizeProperty); }
set { SetValue(PercentFontSizeProperty, value); }
}
public static readonly DependencyProperty PercentFontSizeProperty =
DependencyProperty.Register("PercentFontSize", typeof(int), typeof(circularProgressBar));
public string PercentText
{
get { return (string)GetValue(PercentTextProperty); }
set { SetValue(PercentTextProperty, value); }
}
public static readonly DependencyProperty PercentTextProperty =
DependencyProperty.Register("PercentText", typeof(string), typeof(circularProgressBar));
public int Value
{
get { return (int)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(int), typeof(circularProgressBar));
}
[ValueConversion(typeof(int), typeof(double))]
public class ValueToAngleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (double)((int)value * 0.01) * 360;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return (double)((int)value * 360) * 100;
}
}
[ValueConversion(typeof(int), typeof(double))]
public class ValueToTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.Format("{0}{1}", value.ToString(), "%");
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}