我試圖自動化流利的功能區控件(www.fluent.codeplex.com)。我成功地將大部分控件自動化。但有一個問題,如關閉,最大化和最小化按鈕不被UI自動化工具識別或識別,例如使用Visual Studio的編碼UI測試。間諜工具不識別關閉,最大化,最小化等按鈕。我無法通過自動化關閉應用程序(使用流暢的功能區)。在Fluent(Codeplex)功能區中自動關閉,最大化和最小化功能區 - WPF應用程序
我在RibbonWindow.xaml
<StackPanel x:Name="PART_ButtonsPanel" HorizontalAlignment="Right" Margin="0,8,8,0" VerticalAlignment="Top" Orientation="Horizontal">
<Button x:Name="minimizeButton" Style="{DynamicResource CaptionButtonStyle}" Width="35" Height="19" BorderThickness="1,0,0,1" Command="{x:Static Fluent:RibbonWindow.MinimizeCommand}">
<Image Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" Source="{DynamicResource ImageCaptionButtonMinimize}" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
</Button>
<Button x:Name="maximizeButton" Margin="-1,0,0,0" Style="{DynamicResource CaptionButtonStyle}" Width="35" Height="19" BorderThickness="0,0,0,1" Command="{x:Static Fluent:RibbonWindow.MaximizeCommand}">
<Image Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" Source="{DynamicResource ImageCaptionButtonMaximize}" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
</Button>
<Button x:Name="normalizeButton" Margin="-1,0,0,0" Style="{DynamicResource CaptionButtonStyle}" Width="35" Height="19" BorderThickness="0,0,0,1" Command="{x:Static Fluent:RibbonWindow.NormalizeCommand}">
<Image Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" Source="{DynamicResource ImageCaptionButtonNormalize}" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
</Button>
<Button x:Name="closeButton" Margin="-1,0,0,0" Style="{DynamicResource CaptionButtonStyle}" Width="35" Height="19" BorderThickness="0,0,1,1" Background="Red" Command="{x:Static Fluent:RibbonWindow.CloseCommand}">
<Image Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" Source="{DynamicResource ImageCaptionButtonClose}" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
</Button>
</StackPanel>
看着下面的代碼段我試過很多的東西(像把自動化標識),但沒有奏效。我在看代碼的錯誤部分?
有人可以幫助把自動化用戶界面或名稱放在關閉按鈕或通過爲什麼我可以解決問題的一些變化?唯一的要求是應用程序的「關閉」,「最大化」,「最小化」按鈕應通過UI自動化工具進行識別。
問候
任何解決方案?我已將此報告給Codeplex,但尚未回覆。 – user1134352 2012-01-06 20:06:54