/// <summary> /// Initializes a new instance of the <see cref="ListTimePickerPopup"/> class. /// </summary> public ListTimePickerPopup() : base() { DefaultStyleKey = typeof(ListTimePickerPopup); TimeItemsSelection = new ItemSelectionHelper <KeyValuePair <string, DateTime?> > { Items = new ObservableCollection <KeyValuePair <string, DateTime?> >() }; }
public virtual void ShouldFillSelectionWithAPeer() { ListTimePickerPopup ltp = new ListTimePickerPopup(); ISelectionProvider provider = null; ItemSelectionHelper <KeyValuePair <string, DateTime?> > helper = null; TestAsync( ltp, () => provider = (ISelectionProvider)FrameworkElementAutomationPeer.CreatePeerForElement(ltp), () => helper = ltp.TimeItemsSelection, () => Assert.IsTrue(provider.GetSelection().Length == 0), () => helper.SelectedItem = helper.Items[3], () => Assert.IsNotNull(provider.GetSelection(), "There have been intermittent Automation problems where the ListBoxAutomationPeer reports null children."), () => Assert.IsTrue(provider.GetSelection().Length == 1)); }
/// <summary> /// TimeItemsSelectionProperty property changed handler. /// </summary> /// <param name="d">ListTimePickerPopup that changed its TimeItemsSelection.</param> /// <param name="e">Event arguments.</param> private static void OnTimeItemsSelectionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { ListTimePickerPopup source = (ListTimePickerPopup)d; ItemSelectionHelper <KeyValuePair <string, DateTime?> > oldValue = e.OldValue as ItemSelectionHelper <KeyValuePair <string, DateTime?> >; ItemSelectionHelper <KeyValuePair <string, DateTime?> > newValue = e.NewValue as ItemSelectionHelper <KeyValuePair <string, DateTime?> >; if (!source._allowWritingTimeItemsSelection) { // set back original value source.TimeItemsSelection = oldValue; throw new ArgumentException(Properties.Resources.ListTimePickerPopup_TimeItemsSelection_ReadOnly); } source.TimeItemsSelectionPropertyChanged(oldValue, newValue); }
/// <summary> /// Initializes a new instance of the <see cref="ListTimePickerPopup"/> class. /// </summary> public ListTimePickerPopup() : base() { DefaultStyleKey = typeof(ListTimePickerPopup); TimeItemsSelection = new ItemSelectionHelper<KeyValuePair<string, DateTime?>> { Items = new ObservableCollection<KeyValuePair<string, DateTime?>>() }; }