Files
BeWoPlaner/BeWo/View/Controls/DPCtrlSaldo.cs
2022-05-16 16:06:26 +02:00

68 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace BeWo.View.Controls
{
public class DPCtrlSaldo : DienstplanerControl
{
public static readonly DependencyProperty SaldoInformationProperty = DependencyProperty.Register(
"SaldoInformation",
typeof(DPCtrlSaldoInformation),
typeof(DPCtrlSaldo),
new UIPropertyMetadata(
(s, e) =>
{
var information = (DPCtrlSaldoInformation)e.NewValue;
var ctrl = (DPCtrlSaldo)s;
if (ctrl != null)
{
ctrl.Text = "";
ctrl.ToolTip = "";
if (information != null)
{
if (information.Row == 0 && !information.Statuszeile)
{
ctrl.Text = string.Format("{0:0.00}", information.SaldoWert);
ctrl.ToolTip = "Saldo-Wert";
}
if (information.Statuszeile)
ctrl.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 2);
else
{
if (information.IsLastRow)
ctrl.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1.5);
else
ctrl.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 0);
}
}
}
}));
public DPCtrlSaldo()
{
InitializeComponent();
//BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1);
txt.HorizontalAlignment = HorizontalAlignment.Right;
}
public DPCtrlSaldoInformation SaldoInformation
{
get { return (DPCtrlSaldoInformation)GetValue(SaldoInformationProperty); }
set { SetValue(SaldoInformationProperty, value); }
}
}
public class DPCtrlSaldoInformation
{
public int Row { get; set; }
public bool Statuszeile { get; set; }
public decimal SaldoWert { get; set; }
public bool IsLastRow { get; set; }
}
}