private void CreateItems(int itemsCount, ObservableCollection <TimeButton> list) { for (int i = 0; i < itemsCount; i++) { TimeButton timeButton = new TimeButton(); timeButton.SetValue(TimeButton.HeightProperty, this.ItemHeight); timeButton.SetValue(TimeButton.DataContextProperty, i); timeButton.SetValue(TimeButton.ContentProperty, (i < 10) ? "0" + i : i.ToString()); timeButton.SetValue(TimeButton.IsSelectedProperty, false); list.Add(timeButton); } }
private void CreateExtraItem(ObservableCollection <TimeButton> list) { double height = this.ItemHeight; if (this.Owner != null) { height = this.Owner.DropDownHeight; } else { height = double.IsNaN(this.Height) ? height : this.Height; } for (int i = 0; i < (height - this.ItemHeight) / this.ItemHeight; i++) { TimeButton timeButton = new TimeButton(); timeButton.SetValue(TimeButton.HeightProperty, this.ItemHeight); timeButton.SetValue(TimeButton.IsEnabledProperty, false); timeButton.SetValue(TimeButton.IsSelectedProperty, false); list.Add(timeButton); } }