agrobot_base/AgroBase/OperationControl/Controls/LabeledBar.xaml.cs

62 lines
3.8 KiB
C#

using System.Windows;
using System.Windows.Media;
using UserControl = System.Windows.Controls.UserControl;
using Brush = System.Windows.Media.Brush;
using Brushes = System.Windows.Media.Brushes;
using Color = System.Windows.Media.Color;
namespace OperationControl.Controls
{
/// <summary>
/// Interaction logic for LabeledBar.xaml
/// </summary>
public partial class LabeledBar : UserControl
{
public LabeledBar()
{
InitializeComponent();
}
public string Label { get => (string)GetValue(LabelProperty); set => SetValue(LabelProperty, value); }
public static readonly DependencyProperty LabelProperty =
DependencyProperty.Register(nameof(Label), typeof(string), typeof(LabeledBar), new PropertyMetadata(""));
public double Minimum { get => (double)GetValue(MinimumProperty); set => SetValue(MinimumProperty, value); }
public static readonly DependencyProperty MinimumProperty =
DependencyProperty.Register(nameof(Minimum), typeof(double), typeof(LabeledBar), new PropertyMetadata(0d));
public double Maximum { get => (double)GetValue(MaximumProperty); set => SetValue(MaximumProperty, value); }
public static readonly DependencyProperty MaximumProperty =
DependencyProperty.Register(nameof(Maximum), typeof(double), typeof(LabeledBar), new PropertyMetadata(100d));
public double Value { get => (double)GetValue(ValueProperty); set => SetValue(ValueProperty, value); }
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register(nameof(Value), typeof(double), typeof(LabeledBar), new PropertyMetadata(0d));
public string ValueFormat { get => (string)GetValue(ValueFormatProperty); set => SetValue(ValueFormatProperty, value); }
public static readonly DependencyProperty ValueFormatProperty =
DependencyProperty.Register(nameof(ValueFormat), typeof(string), typeof(LabeledBar), new PropertyMetadata("{0:0}%"));
public string RightText { get => (string)GetValue(RightTextProperty); set => SetValue(RightTextProperty, value); }
public static readonly DependencyProperty RightTextProperty =
DependencyProperty.Register(nameof(RightText), typeof(string), typeof(LabeledBar), new PropertyMetadata(""));
public Brush BarBrush { get => (Brush)GetValue(BarBrushProperty); set => SetValue(BarBrushProperty, value); }
public static readonly DependencyProperty BarBrushProperty =
DependencyProperty.Register(nameof(BarBrush), typeof(Brush), typeof(LabeledBar),
new PropertyMetadata(new SolidColorBrush(Color.FromRgb(0x2E, 0xCC, 0x71))));
public Brush BackgroundBrush { get => (Brush)GetValue(BackgroundBrushProperty); set => SetValue(BackgroundBrushProperty, value); }
public static readonly DependencyProperty BackgroundBrushProperty =
DependencyProperty.Register(nameof(BackgroundBrush), typeof(Brush), typeof(LabeledBar),
new PropertyMetadata(new SolidColorBrush(Color.FromRgb(0x22, 0x22, 0x22))));
public Brush BorderBrush { get => (Brush)GetValue(BorderBrushProperty); set => SetValue(BorderBrushProperty, value); }
public static readonly DependencyProperty BorderBrushProperty =
DependencyProperty.Register(nameof(BorderBrush), typeof(Brush), typeof(LabeledBar),
new PropertyMetadata(new SolidColorBrush(Color.FromRgb(0x44, 0x44, 0x44))));
public Brush TextBrush { get => (Brush)GetValue(TextBrushProperty); set => SetValue(TextBrushProperty, value); }
public static readonly DependencyProperty TextBrushProperty =
DependencyProperty.Register(nameof(TextBrush), typeof(Brush), typeof(LabeledBar),
new PropertyMetadata(Brushes.White));
}
}