using BS.Shared.DataContracts; 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 DPCtrlWeek : DienstplanerControl { public static readonly DependencyProperty DienstInfoDCListProperty = DependencyProperty.Register( "DienstInfoDCList", typeof(List), typeof(DPCtrlWeek), new UIPropertyMetadata( (s, e) => { var dc = (List)e.NewValue; var c = (DPCtrlWeek)s; if (c != null) { if (dc != null) { dc.RemoveAll(x => x == null); c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 1); double res = 0.0; if (dc.Count != 0) foreach (var x in dc) { res += x.DurationHours; } c.Text = res.ToString("0.##"); } else { c.BorderBlack.BorderThickness = new Thickness(0, 0, 1, 0); c.Text = ""; } } })); public DPCtrlWeek() { InitializeComponent(); BorderBlack.BorderThickness = new Thickness(0, 0, 1, 0); txt.TextAlignment = TextAlignment.Left; txt.HorizontalAlignment = HorizontalAlignment.Left; } public List DienstInfoDCList { get { return (List)GetValue(DienstInfoDCListProperty); } set { SetValue(DienstInfoDCListProperty, value); } } } }