/// <summary>
        /// Sets the value of an element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="value">The value to set the element's value to.</param>
        private static void SetValue(UIElement element, string value)
        {
            FrameworkElementAutomationPeer elementPeer = FrameworkElementAutomationPeer.CreatePeerForElement(element) as FrameworkElementAutomationPeer;
            IValueProvider elementValueProvider        = elementPeer.GetPattern(PatternInterface.Value) as IValueProvider;

            elementValueProvider.SetValue(value);
        }
Ejemplo n.º 2
0
        public void SetValue()
        {
            ProgressBarConcrete            concrete = new ProgressBarConcrete();
            FrameworkElementAutomationPeer peer
                = CreateConcreteFrameworkElementAutomationPeer(concrete)
                  as FrameworkElementAutomationPeer;
            var rangeValue = peer.GetPattern(PatternInterface.RangeValue)
                             as IRangeValueProvider;

            rangeValue.SetValue(0);
        }
Ejemplo n.º 3
0
        public void SelectionItemProvider_SelectionContainer()
        {
            RadioButton rb1 = CreateConcreteFrameworkElement() as RadioButton;
            RadioButton rb2 = CreateConcreteFrameworkElement() as RadioButton;

            rb1.GroupName = rb2.GroupName = "Fruit";

            ListBox listBox = new ListBox();

            listBox.Items.Add(rb1);
            listBox.Items.Add(rb2);
            TestPanel.Children.Add(listBox);

            RadioButton rb3 = CreateConcreteFrameworkElement() as RadioButton;
            RadioButton rb4 = CreateConcreteFrameworkElement() as RadioButton;

            StackPanel stackPanel = new StackPanel();

            stackPanel.Children.Add(rb3);
            stackPanel.Children.Add(rb4);
            TestPanel.Children.Add(stackPanel);

            Enqueue(() => {
                FrameworkElementAutomationPeer radioPeer1
                    = CreateConcreteFrameworkElementAutomationPeer(rb1)
                      as FrameworkElementAutomationPeer;
                FrameworkElementAutomationPeer radioPeer3
                    = CreateConcreteFrameworkElementAutomationPeer(rb3)
                      as FrameworkElementAutomationPeer;

                ISelectionItemProvider selectionItem1
                    = radioPeer1.GetPattern(PatternInterface.SelectionItem)
                      as ISelectionItemProvider;
                Assert.IsNotNull(selectionItem1);

                ISelectionItemProvider selectionItem3
                    = radioPeer3.GetPattern(PatternInterface.SelectionItem)
                      as ISelectionItemProvider;
                Assert.IsNotNull(selectionItem3);

                Assert.IsNull(selectionItem1.SelectionContainer,
                              "selectionItem1's container is not null");
                Assert.IsNull(selectionItem3.SelectionContainer,
                              "selectionItem2's container is not null");
            });
            EnqueueTestComplete();
        }
Ejemplo n.º 4
0
        public void IsReadOnly()
        {
            ProgressBarConcrete            concrete = new ProgressBarConcrete();
            FrameworkElementAutomationPeer peer
                = CreateConcreteFrameworkElementAutomationPeer(concrete)
                  as FrameworkElementAutomationPeer;
            var rangeValue = peer.GetPattern(PatternInterface.RangeValue)
                             as IRangeValueProvider;

            Assert.IsTrue(concrete.IsEnabled);
            Assert.IsTrue(peer.IsEnabled());
            Assert.IsTrue(rangeValue.IsReadOnly);

            concrete.IsEnabled = false;
            Assert.IsFalse(peer.IsEnabled());
            Assert.IsTrue(rangeValue.IsReadOnly);
        }