简体   繁体   English

Silk Test无法识别Windows Forms主机中托管的WPF控件

[英]Silk Test doesn't identify WPF control hosted in Windows Forms host

I have a simple WPF user control: 我有一个简单的WPF用户控件:

<StackPanel>
    <Button>Test</Button>
    <TextBox>Test</TextBox>
    <TextBlock>Test</TextBlock>
</StackPanel>

I am hosting this user control inside Windows Forms host. 我将这个用户控件托管在Windows Forms主机中。 Silk Test identifies this entire user control as Element-Host only and is not able to identify individual buttons or text-boxes. Silk Test仅将整个用户控件标识为Element-Host ,而不能标识单个按钮或文本框。

Has anybody more insight on this? 有人对此有更多见解吗? Is this scenario supported by Silk Test? Silk Test支持这种情况吗?

Update : 更新:

I have little success with Silk Test 14.0 (Earlier i had 13.5). 我使用Silk Test 14.0取得的成功很小(以前我的使用率为13.5)。 Created test application with similar structure (WPF Control in windows forms host) and checked with Silk Test 14.0 . 创建具有类似结构的测试应用程序(Windows窗体主机中的WPF控件),并使用Silk Test 14.0进行了检查。 It is able to detect all individual WPF controls within user-control . 它能够检测用户控件内的所有单个WPF控件。 But with my application, it is still not able to detect controls apart from 2 combo-boxes in "Toolbar". 但是对于我的应用程序,除了“工具栏”中的两个组合框外,它仍然无法检测控件。 In user-control, i am using custom grid which is derived from Data-grid class 在用户控制中,我正在使用自Data-grid类派生的自定义网格

This should work. 这应该工作。

It might depend on how you are embedding the UserControl though. 但是,这可能取决于您如何嵌入UserControl

In the application we are using for testing it is contained in a Windows Forms ElementHost -control. 在我们用于测试的应用程序中,它包含在Windows Forms ElementHost -control中。 In the code-behind you should see member declarations for both the ElementHost and your UserControl , is this the case? 在后面的代码中,您应该看到ElementHostUserControl成员声明,​​是这样吗?

Is your application using multiple AppDomain s? 您的应用程序使用多个AppDomain吗? Silk Test currently only supports multiple AppDomains for Windows Forms, not for WPF so this might be another reason why it isn't working for you. Silk Test当前仅支持Windows窗体的多个AppDomain,而不支持WPF,因此这可能是它对您不起作用的另一个原因。

I don't know Silk Test well but it seems to me that this tool supports only standalone WPF applications. 我对Silk Test不太了解,但是在我看来,该工具仅支持独立的WPF应用程序。 In your case, there is a standalone WinForms application with embedded WPFs controls. 在您的情况下,有一个带有嵌入式WPF控件的独立WinForms应用程序。 Documentation says: 文档说:

Silk Test Workbench provides built-in support for testing Windows Presentation Foundation (WPF) applications. Silk Test Workbench为测试Windows Presentation Foundation(WPF)应用程序提供了内置支持。 Silk Test Workbench supports standalone WPF applications and can record and play back controls embedded in .NET version 3.5 or later. Silk Test Workbench支持独立的 WPF应用程序,并且可以记录和播放.NET 3.5或更高版本中嵌入的控件。

Silk Test team has identified this to be a bug. Silk Test团队已将其识别为错误。 Fix may be released as a patch over Silk Test 15.5 version. 修复程序可能作为Silk Test 15.5版本的补丁程序发布。 I will update this post once i have better details on its release. 一旦我对它的发布有了更好的细节,我将对其进行更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM