Example #1
0
        protected override void Popup_Opened(object sender, EventArgs e)
        {
            base.Popup_Opened(sender, e);

            if (_timeListBox != null)
            {
                this.UpdateListBoxItems();

                TimeSpan time        = (Value != null) ? Value.Value.TimeOfDay : StartTimeDefaultValue;
                TimeItem nearestItem = this.GetNearestTimeItem(time);
                if (nearestItem != null)
                {
                    _timeListBox.ScrollIntoView(nearestItem);
                    ListBoxItem listBoxItem = ( ListBoxItem )_timeListBox.ItemContainerGenerator.ContainerFromItem(nearestItem);
                    if (listBoxItem != null)
                    {
                        listBoxItem.Focus();
                    }
                }
            }
        }