コード例 #1
0
        public DateTimeFieldControl(object metaField)
            : base()
        {
            this.metaField = (IDictionary <string, object>)metaField;
            this.FieldName = (string)this.metaField["name"];

            var layoutRoot = new Grid();

            this.Content = layoutRoot;

            var col1 = new ColumnDefinition()
            {
                Width = GridLength.Auto
            };                                                             //new GridLength(50, GridUnitType.Star) };
            var col2 = new ColumnDefinition()
            {
                Width = GridLength.Auto
            };                                                             //new GridLength(50, GridUnitType.Star) };

            layoutRoot.ColumnDefinitions.Add(col1);
            layoutRoot.ColumnDefinitions.Add(col2);

            this.datePicker = new DatePicker();
            this.datePicker.SetValue(Grid.ColumnProperty, 0);
            this.datePicker.VerticalContentAlignment = System.Windows.VerticalAlignment.Center;
            this.datePicker.VerticalAlignment        = System.Windows.VerticalAlignment.Center;
            layoutRoot.Children.Add(datePicker);

            this.timeUpDown = new TimeUpDown();
            this.timeUpDown.SetValue(Grid.ColumnProperty, 1);
            this.timeUpDown.VerticalContentAlignment = System.Windows.VerticalAlignment.Center;
            this.timeUpDown.VerticalAlignment        = System.Windows.VerticalAlignment.Center;
            layoutRoot.Children.Add(timeUpDown);
        }
コード例 #2
0
        public virtual void TimeUpDownPeerOnlySupportsValuePattern()
        {
            TimeUpDown item = new TimeUpDown();
            TimeUpDownAutomationPeer peer = null;

            TestAsync(
                item,
                () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(item) as TimeUpDownAutomationPeer,
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Dock), "TimeUpDownAutomationPeer should not support the Dock pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.ExpandCollapse), "TimeUpDownAutomationPeer should not support the ExpandCollapse pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Grid), "TimeUpDownAutomationPeer should not support the Grid pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.GridItem), "TimeUpDownAutomationPeer should not support the GridItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Invoke), "TimeUpDownAutomationPeer should not support the Dock pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.MultipleView), "TimeUpDownAutomationPeer should not support the MultipleView pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.RangeValue), "TimeUpDownAutomationPeer should not support the RangeValue pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Scroll), "TimeUpDownAutomationPeer should not support the Scroll pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.ScrollItem), "TimeUpDownAutomationPeer should not support the ScrollItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Selection), "TimeUpDownAutomationPeer should not support the Selection pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Table), "TimeUpDownAutomationPeer should not support the Table pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.TableItem), "TimeUpDownAutomationPeer should not support the TableItem pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Toggle), "TimeUpDownAutomationPeer should not support the Toggle pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Transform), "TimeUpDownAutomationPeer should not support the Transform pattern!"),
                () => Assert.IsNotNull(peer.GetPattern(PatternInterface.Value), "TimeUpDownAutomationPeer should support the Value pattern!"),
                () => Assert.IsNull(peer.GetPattern(PatternInterface.Window), "TimeUpDownAutomationPeer should not support the Window pattern!"));
        }
コード例 #3
0
        public virtual void CreateTimeUpDownPeer()
        {
            TimeUpDown tud = new TimeUpDown();
            TimeUpDownAutomationPeer peer = new TimeUpDownAutomationPeer(tud);

            Assert.IsNotNull(peer);
        }
コード例 #4
0
        public virtual void TimeUpDownPeerIsIValueProvider()
        {
            TimeUpDown     tud      = new TimeUpDown();
            IValueProvider provider = null;

            TestAsync(
                tud,
                () => provider = FrameworkElementAutomationPeer.CreatePeerForElement(tud) as IValueProvider,
                () => Assert.IsNotNull(provider, "TimeUpDownAutomationPeer should implement IValueProvider!"));
        }
コード例 #5
0
 public virtual void TimeUpDownCreatesCorrectAutomationPeer()
 {
     TimeUpDown tud = new TimeUpDown();
     TimeUpDownAutomationPeer peer = null;
     TestAsync(
         tud,
         () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(tud) as TimeUpDownAutomationPeer,
         () => Assert.IsNotNull(peer, "TimeUpDown peer should not be null!"),
         () => Assert.AreEqual(tud, peer.Owner, "TimeUpDown should be owner of the peer!"));
 }
コード例 #6
0
        public virtual void TimeUpDownCreatesCorrectAutomationPeer()
        {
            TimeUpDown tud = new TimeUpDown();
            TimeUpDownAutomationPeer peer = null;

            TestAsync(
                tud,
                () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(tud) as TimeUpDownAutomationPeer,
                () => Assert.IsNotNull(peer, "TimeUpDown peer should not be null!"),
                () => Assert.AreEqual(tud, peer.Owner, "TimeUpDown should be owner of the peer!"));
        }
コード例 #7
0
        public virtual void ShouldCorrelateReadOnlyToIsEnabledInAutomationPeer()
        {
            TimeUpDown item = new TimeUpDown();

            item.Value = new DateTime(1900, 1, 1, 3, 45, 12);
            TimeUpDownAutomationPeer peer     = null;
            IValueProvider           provider = null;

            TestAsync(
                item,
                () => peer     = (TimeUpDownAutomationPeer)FrameworkElementAutomationPeer.CreatePeerForElement(item),
                () => provider = (IValueProvider)peer.GetPattern(PatternInterface.Value),
                () => Assert.IsFalse(provider.IsReadOnly),
                () => item.IsEnabled = false,
                () => Assert.IsTrue(provider.IsReadOnly));
        }
コード例 #8
0
        public virtual void ShouldBeAbleToGetValueThroughAutomationPeer()
        {
            TimeUpDown item = new TimeUpDown();

            item.Culture = new CultureInfo("nl-NL");
            item.Format  = new CustomTimeFormat("HH:mm:ss");
            item.Value   = new DateTime(1900, 1, 1, 3, 45, 12);
            TimeUpDownAutomationPeer peer     = null;
            IValueProvider           provider = null;

            TestAsync(
                item,
                () => peer     = (TimeUpDownAutomationPeer)FrameworkElementAutomationPeer.CreatePeerForElement(item),
                () => provider = (IValueProvider)peer.GetPattern(PatternInterface.Value),
                () => Assert.AreEqual(provider.Value, "03:45:12"));
        }
コード例 #9
0
 public virtual void TimeUpDownPeerOnlySupportsValuePattern()
 {
     TimeUpDown item = new TimeUpDown();
     TimeUpDownAutomationPeer peer = null;
     TestAsync(
         item,
         () => peer = FrameworkElementAutomationPeer.CreatePeerForElement(item) as TimeUpDownAutomationPeer,
         () => Assert.IsNull(peer.GetPattern(PatternInterface.Dock), "TimeUpDownAutomationPeer should not support the Dock pattern!"),
         () => Assert.IsNull(peer.GetPattern(PatternInterface.ExpandCollapse), "TimeUpDownAutomationPeer should not support the ExpandCollapse pattern!"),
         () => Assert.IsNull(peer.GetPattern(PatternInterface.Grid), "TimeUpDownAutomationPeer should not support the Grid pattern!"),
         () => Assert.IsNull(peer.GetPattern(PatternInterface.GridItem), "TimeUpDownAutomationPeer should not support the GridItem pattern!"),
         () => Assert.IsNull(peer.GetPattern(PatternInterface.Invoke), "TimeUpDownAutomationPeer should not support the Dock pattern!"),
         () => Assert.IsNull(peer.GetPattern(PatternInterface.MultipleView), "TimeUpDownAutomationPeer should not support the MultipleView pattern!"),
         () => Assert.IsNull(peer.GetPattern(PatternInterface.RangeValue), "TimeUpDownAutomationPeer should not support the RangeValue pattern!"),
         () => Assert.IsNull(peer.GetPattern(PatternInterface.Scroll), "TimeUpDownAutomationPeer should not support the Scroll pattern!"),
         () => Assert.IsNull(peer.GetPattern(PatternInterface.ScrollItem), "TimeUpDownAutomationPeer should not support the ScrollItem pattern!"),
         () => Assert.IsNull(peer.GetPattern(PatternInterface.Selection), "TimeUpDownAutomationPeer should not support the Selection pattern!"),
         () => Assert.IsNull(peer.GetPattern(PatternInterface.Table), "TimeUpDownAutomationPeer should not support the Table pattern!"),
         () => Assert.IsNull(peer.GetPattern(PatternInterface.TableItem), "TimeUpDownAutomationPeer should not support the TableItem pattern!"),
         () => Assert.IsNull(peer.GetPattern(PatternInterface.Toggle), "TimeUpDownAutomationPeer should not support the Toggle pattern!"),
         () => Assert.IsNull(peer.GetPattern(PatternInterface.Transform), "TimeUpDownAutomationPeer should not support the Transform pattern!"),
         () => Assert.IsNotNull(peer.GetPattern(PatternInterface.Value), "TimeUpDownAutomationPeer should support the Value pattern!"),
         () => Assert.IsNull(peer.GetPattern(PatternInterface.Window), "TimeUpDownAutomationPeer should not support the Window pattern!"));
 }
コード例 #10
0
 public virtual void TimeUpDownPeerIsIValueProvider()
 {
     TimeUpDown tud = new TimeUpDown();
     IValueProvider provider = null;
     TestAsync(
         tud,
         () => provider = FrameworkElementAutomationPeer.CreatePeerForElement(tud) as IValueProvider,
         () => Assert.IsNotNull(provider, "TimeUpDownAutomationPeer should implement IValueProvider!"));
 }
コード例 #11
0
 public virtual void CreateTimeUpDownPeer()
 {
     TimeUpDown tud = new TimeUpDown();
     TimeUpDownAutomationPeer peer = new TimeUpDownAutomationPeer(tud);
     Assert.IsNotNull(peer);
 }
コード例 #12
0
        public virtual void ShouldCorrelateReadOnlyToIsEnabledInAutomationPeer()
        {
            TimeUpDown item = new TimeUpDown();
            item.Value = new DateTime(1900, 1, 1, 3, 45, 12);
            TimeUpDownAutomationPeer peer = null;
            IValueProvider provider = null;

            TestAsync(
                    item,
                    () => peer = (TimeUpDownAutomationPeer)FrameworkElementAutomationPeer.CreatePeerForElement(item),
                    () => provider = (IValueProvider)peer.GetPattern(PatternInterface.Value),
                    () => Assert.IsFalse(provider.IsReadOnly),
                    () => item.IsEnabled = false,
                    () => Assert.IsTrue(provider.IsReadOnly));
        }
コード例 #13
0
        public virtual void ShouldBeAbleToGetValueThroughAutomationPeer()
        {
            TimeUpDown item = new TimeUpDown();
            item.Culture = new CultureInfo("nl-NL");
            item.Format = new CustomTimeFormat("HH:mm:ss");
            item.Value = new DateTime(1900, 1, 1, 3, 45, 12);
            TimeUpDownAutomationPeer peer = null;
            IValueProvider provider = null;

            TestAsync(
                    item,
                    () => peer = (TimeUpDownAutomationPeer)FrameworkElementAutomationPeer.CreatePeerForElement(item),
                    () => provider = (IValueProvider)peer.GetPattern(PatternInterface.Value),
                    () => Assert.AreEqual(provider.Value, "03:45:12"));
        }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the TimeUpDownAutomationPeer class.
 /// </summary>
 /// <param name="owner">
 /// The TimeUpDown that is associated with this TimeUpDownAutomationPeer.
 /// </param>
 public TimeUpDownAutomationPeer(TimeUpDown owner)
     : base(owner)
 {
 }