Ticket Q411045
Visible to All Users

UI Automation tree is not updated when NavBar is present and dynamically created controls are added

created 13 years ago

I need to write UI Automation test for the application where yours NavBar is used. the problem is when I dynamically create some views, they are not appears in the UI Automation tree. Without yours NavBar they are appeared.
I've attached video and sample project. To see the difference, use Inspect.exe tools from Microsoft.
Try #1 - as is, with NavBar;
Try #2 - comment NavBar (or remove it from xaml).

here the simple app that shows root cause:
I want you explain me why this happened and fix this bug.

MainWindow.xaml

<Window x:Class="UIA.WithNavBarControl.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" xmlns:dxn="http://schemas.devexpress.com/winfx/2008/xaml/navbar">
<Grid Name="ContentGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<dxn:NavBarControl Name="navBarControl1">
<dxn:NavBarControl.Groups>
<dxn:NavBarGroup Header="navBarGroup1" Name="navBarGroup1">

</dxn:NavBarGroup>
</dxn:NavBarControl.Groups>
</dxn:NavBarControl>

<TextBox Grid.Column="1" Name="Statictb" Text="I'm a staticaly created control" />
<Button Grid.Row="1" Content="Create controls" Height="25" Click="Button_Click"/>
</Grid>
</Window>

MainWindow.xaml.cs

using System;
using System.Windows;
using System.Windows.Controls;

namespace UIA.WithNavBarControl
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
TextBox tb = new TextBox();
Grid.SetRow(tb, 1);
Grid.SetColumn(tb, 1);
tb.Text = "I'm dynamically created control";
ContentGrid.Children.Add(tb);
}
}
}

Comments (1)
DevExpress Support Team 13 years ago

    We are working on this issue. Please bear with us.

    Answers

    created 13 years ago (modified 13 years ago)

    We have researched this issue. After a peer is created, listening of automation events may cause performance issues. We have decided to clear invocation lists of automation events to resolve it. In your specific situation, you need to disabling clearing. To do it, please set the static DevExpress.Xpf.Core.ClearAutomationEventsHelper.IsEnabled property to False in the Window constructor. This will resolve the issue.

      Show previous comments (2)

        Example I've attach - its simple situation which shows the problem. Another way (I have met it) is when you need to change DataContext or Content of ContentControl, and show another UserConrol to the user (when user click NavBar items button or group buttons, application should change the view according with user selection - Content will changed, and because of your NavBar - UI Automation tree will be out-of-date).

        DevExpress Support Team 13 years ago

          We are discussing this issue. Please bear with us.

          DevExpress Support Team 13 years ago

            Hello Vitaly,
            We have discussed this issue and have decided not to change our current implementation, but to create an article on how to use UI Automation with our controls (this is not only NavBar problem): Documentation - Describe how to enable all UI Automation events when DXControls are used. The number of users that use UI Automation is less than users that do not use UI Automation.
            As an example, you can review the following thread:Delay in Opening BarItem. This illustrates how much time it takes to find an application that use UIAutomation.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.