41 lines
1.6 KiB
C#
41 lines
1.6 KiB
C#
|
|
using System.Windows;
|
||
|
|
using System.Windows.Controls;
|
||
|
|
using System.Windows.Media;
|
||
|
|
|
||
|
|
namespace EngineeringSync.Setup.Views.Pages;
|
||
|
|
|
||
|
|
public partial class SummaryBoolRow : UserControl
|
||
|
|
{
|
||
|
|
public static readonly DependencyProperty LabelProperty =
|
||
|
|
DependencyProperty.Register(nameof(Label), typeof(string), typeof(SummaryBoolRow),
|
||
|
|
new PropertyMetadata(string.Empty, (d, e) => ((SummaryBoolRow)d).LabelText.Text = (string)e.NewValue));
|
||
|
|
|
||
|
|
public static readonly DependencyProperty ValueProperty =
|
||
|
|
DependencyProperty.Register(nameof(Value), typeof(bool), typeof(SummaryBoolRow),
|
||
|
|
new PropertyMetadata(false, (d, e) => ((SummaryBoolRow)d).UpdateVisual((bool)e.NewValue)));
|
||
|
|
|
||
|
|
public string Label { get => (string)GetValue(LabelProperty); set => SetValue(LabelProperty, value); }
|
||
|
|
public bool Value { get => (bool)GetValue(ValueProperty); set => SetValue(ValueProperty, value); }
|
||
|
|
|
||
|
|
public SummaryBoolRow() => InitializeComponent();
|
||
|
|
|
||
|
|
private void UpdateVisual(bool isOn)
|
||
|
|
{
|
||
|
|
if (CheckIcon is null) return;
|
||
|
|
if (isOn)
|
||
|
|
{
|
||
|
|
CheckIcon.Text = "\uE73E";
|
||
|
|
CheckIcon.Foreground = new SolidColorBrush(Color.FromRgb(16, 124, 16));
|
||
|
|
ValueText.Text = "Ja";
|
||
|
|
ValueText.Foreground = new SolidColorBrush(Color.FromRgb(16, 124, 16));
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
CheckIcon.Text = "\uE711";
|
||
|
|
CheckIcon.Foreground = new SolidColorBrush(Color.FromRgb(160, 160, 160));
|
||
|
|
ValueText.Text = "Nein";
|
||
|
|
ValueText.Foreground = new SolidColorBrush(Color.FromRgb(160, 160, 160));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|