Files
BeWoPlaner/BeWo/View/Controls/DPCtrlIst.cs
2021-10-18 00:43:47 +02:00

69 lines
2.4 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 DPCtrlIst : DienstplanerControl
{
public static readonly DependencyProperty IstInformationProperty = DependencyProperty.Register(
"IstInformation",
typeof(DPCtrlIstInformation),
typeof(DPCtrlIst),
new UIPropertyMetadata(
(s, e) =>
{
var information = (DPCtrlIstInformation)e.NewValue;
var ctrl = (DPCtrlIst)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.IstWert);
ctrl.ToolTip = "Ist-Wert";
}
if (information.Statuszeile)
ctrl.BorderBlack.BorderThickness = new Thickness(0, 0, 0, 2);
else
{
if (information.IsLastRow)
ctrl.BorderBlack.BorderThickness = new Thickness(0, 0, 0, 1);
else
ctrl.BorderBlack.BorderThickness = new Thickness(0, 0, 0, 0);
}
}
}
}));
public DPCtrlIst()
{
InitializeComponent();
//BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1);
txt.HorizontalAlignment = HorizontalAlignment.Right;
}
public DPCtrlIstInformation IstInformation
{
get { return (DPCtrlIstInformation)GetValue(IstInformationProperty); }
set { SetValue(IstInformationProperty, value); }
}
}
public class DPCtrlIstInformation
{
public int Row { get; set; }
public bool Statuszeile { get; set; }
public decimal IstWert { get; set; }
public bool IsLastRow { get; set; }
}
}