UI Automation support

Dec 2, 2010 at 7:13 AM

Fluent 2.0 version has better UI automation support. Most of the controls have good idetification in Inspect.exe and can be tested using Coded UI in Visual Studio2010 Ultimate.

But RibbonTabItem, DropdownButton, SplitButton and TwolineLabel are not testable using Coded UI which is because TextBlock has no support for Access/Accerelator Keys. I fixed the problems by using Label and AccessText instead. See the changes below.

Can we get them fixed to get better UI Automation support for all of the fluent controls?

In RibbonTabItem.xaml:

<Border x:Name="PART_ContentContainer" HorizontalAlignment="Stretch" Margin="6,2,4,2" VerticalAlignment="Stretch" Padding="15,0,0,0" Grid.ColumnSpan="1">

                           <!--<ContentPresenter RecognizesAccessKey="True" x:Name="contentPresenter" ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center" Height="Auto">

                          </ContentPresenter>-->

                           <Label x:Name="contentPresenter" AutomationProperties.Name="{Binding Header}" Content="{TemplateBinding Header}" Margin="0, -3, 0,0" HorizontalAlignment="Center" VerticalAlignment="Center" Height="Auto"/>

           </Border>

And change in TwoLineLabel.xaml

<ControlTemplate x:Key="TwoLineLabelControlTemplate" TargetType="{x:Type Fluent:TwoLineLabel}">

     <StackPanel x:Name="stackPanel" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center">

               <AccessText TextWrapping="Wrap" x:Name="PART_TextRun" TextAlignment="Center"></AccessText>

           <StackPanel x:Name="stackPanel1" Margin="0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">

                   <AccessText TextWrapping="Wrap" x:Name="PART_TextRun2" TextAlignment="Center"></AccessText>

               <Border x:Name="border" Height="Auto" Width="5" HorizontalAlignment="Center" Margin="0">

                         <Path x:Name="path" Width="5" Height="3" StrokeThickness="0" Data="M0,0L5,0 2.5,3z" HorizontalAlignment="Center"

                     VerticalAlignment="Center" Margin="0,2,0,0" SnapsToDevicePixels="True" Fill="{TemplateBinding Foreground}"/>

                   </Border>

            </StackPanel>

     </StackPanel>

 

Coordinator
Dec 6, 2010 at 5:07 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Dec 6, 2010 at 6:43 PM

Hi,

Thanks for moving this request to a work item. Just a FYI, I had to use Label instead of ContentPresenter and assign AutomationID and Name on AutomationProperties for the lable.

<Border x:Name="PART_ContentContainer" HorizontalAlignment="Stretch" Margin="6,2,4,2" VerticalAlignment="Stretch" Padding="15,0,0,0" Grid.ColumnSpan="1">

<!--<ContentPresenter RecognizesAccessKey="True" x:Name="contentPresenter" ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center" Height="Auto">

</ContentPresenter>-->

<Label x:Name="contentPresenter" AutomationProperties.Name="{TemplateBinding Header}" AutomationProperties.AutomationId="{TemplateBinding Name}" Content="{TemplateBinding Header}" Margin="0, -3, 0,0" HorizontalAlignment="Center" VerticalAlignment="Center" Height="Auto"/>

</Border>

Thanks,

Xiaoling

From: daVinci [mailto:notifications@codeplex.com]
Sent: Sunday, December 05, 2010 9:07 PM
To: Xiaoling Yang
Subject: Re: UI Automation support [fluent:236819]

From: daVinci

This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.

Read the full discussion online.

To add a post to this discussion, reply to this email (fluent@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email fluent@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Dec 17, 2010 at 12:11 AM

Hi,

  Thanks for putting the fixes so fast.  Could you also fix backstage?

In BackStagee.xaml, build 56048, line 46

<!--<ContentPresenter x:Name="contentPresenter" ContentSource="Header" VerticalAlignment="Center" HorizontalAlignment="Center"/>-->

                       <Label x:Name="contentPresenter" AutomationProperties.AutomationId="{TemplateBinding Name}" AutomationProperties.Name="{Binding Header}" Content="{TemplateBinding Header}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0, -2, 0, 0"/>

In BackStageTabItem.xaml, build 56048, line 30:

<!--<AccessText x:Name="controlLabel" HorizontalAlignment="Left" Margin="20,0" VerticalAlignment="Center" Text="{TemplateBindi-->ng Header}" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"/>

             <TextBlock x:Name="controlLabel" HorizontalAlignment="Left" Margin="20,0" VerticalAlignment="Center" Text="{TemplateBinding Header}" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"/>

 

Dec 11, 2012 at 7:42 PM

The latest fluent in metro style doesn't fully support coded UI in Visual Studio.

Lots of fix I mentioned before in this thread is broken in metro style. One of the example is coded UI can't find ribbon tab item in metro window.

The fix is change control type from TextBlock to AccessText in \Fluent\Themes\Metro\Controls\RibbonTabItem.xaml

           <AccessText x:Name="contentPresenter" FontSize="13" Foreground="#606E71"

                                 AutomationProperties.Name="{TemplateBinding Header}"

                                 AutomationProperties.AutomationId="{TemplateBinding Name}"

                                 Text="{TemplateBinding Header}"

                                 Margin="0, -4, 0,-1"

                                 HorizontalAlignment="Center"

                                 VerticalAlignment="Center"

                                 Height="Auto" />