private void CreateItems(int itemsCount, ObservableCollection <AduTimeButton> list) { for (int i = 0; i < itemsCount; i++) { AduTimeButton timeButton = new AduTimeButton(); timeButton.SetValue(AduTimeButton.HeightProperty, this.ItemHeight); timeButton.SetValue(AduTimeButton.DataContextProperty, i); timeButton.SetValue(AduTimeButton.ContentProperty, (i < 10) ? "0" + i : i.ToString()); timeButton.SetValue(AduTimeButton.IsSelectedProperty, false); list.Add(timeButton); } }
private void CreateExtraItem(ObservableCollection <AduTimeButton> 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++) { AduTimeButton timeButton = new AduTimeButton(); timeButton.SetValue(AduTimeButton.HeightProperty, this.ItemHeight); timeButton.SetValue(AduTimeButton.IsEnabledProperty, false); timeButton.SetValue(AduTimeButton.IsSelectedProperty, false); list.Add(timeButton); } }