Ranorex Spy cannot detect the AutomationProperties.ItemType attached property for WPF list items. This applies to both TreeViewItems and ListBoxItems. In both cases ItemType shows as unset when it has been bound to a valid value.
Snoop sees the ItemType property without issue, Ranorex consistently ignores it on list items; though Ranorex can detect the ItemType property on custom controls and elements.
I can work around this by using the non-intuitive ItemStatus in some cases, but there have been instances where I would like to use both ItemStatus and ItemType on the same list item.
--
Michael
Ranorex Spy cannot detect ItemType on WPF list items
Ranorex Spy cannot detect ItemType on WPF list items
You do not have the required permissions to view the files attached to this post.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Ranorex Spy cannot detect ItemType on WPF list items
Hi,
In comparison to Ranorex, Snoop invokes (and influences) the whole process to get the information out of the application under test.
Ranorex uses UIAutomation in order to get the information of the WPF application.
It seems that there is an issue in the UIAutomation implementation of your listitems. Please check if Microsoft Inspect or Microsoft UISpy is able to get the right value of the property.
Which code do you use to change/set the value of the ItemType property?
Regards,
Markus
In comparison to Ranorex, Snoop invokes (and influences) the whole process to get the information out of the application under test.
Ranorex uses UIAutomation in order to get the information of the WPF application.
It seems that there is an issue in the UIAutomation implementation of your listitems. Please check if Microsoft Inspect or Microsoft UISpy is able to get the right value of the property.
Which code do you use to change/set the value of the ItemType property?
Regards,
Markus
Re: Ranorex Spy cannot detect ItemType on WPF list items
It seems MS Inspect can't find the value of the ItemType property either. I'm setting the value of the attached property right next to the ItemStatus property which is of the same type and that works fine. I am at a a loss.
--
Michael
Code: Select all
<ListBox>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter
Property="AutomationProperties.ItemStatus"
Value="{Binding MediaType}" />
<Setter
Property="AutomationProperties.ItemType"
Value="{Binding MediaType}" />
</Style>
</ListBox.ItemContainerStyle>
<ListBox>
Michael
Michael Rollins
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Ranorex Spy cannot detect ItemType on WPF list items
Hi,
Thank you for sharing your code.
I will analyze the issue in detail and will get back to you as soon as possible.
Regards,
Markus
Thank you for sharing your code.
I will analyze the issue in detail and will get back to you as soon as possible.
Regards,
Markus
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Ranorex Spy cannot detect ItemType on WPF list items
I would have also thought that should work out of the box. Both properties have the same type (string) and have the exactly same code behind.mrollins wrote:It seems MS Inspect can't find the value of the ItemType property either. I'm setting the value of the attached property right next to the ItemStatus property which is of the same type and that works fine. I am at a a loss.
If MS Inspect cannot see the value either, than maybe this is some problem with the "MediaType" property of your data source?
Have you tried binding just the ItemType and not the ItemStatus?
UPDATE: I used reflector to get the code of the default UIA implementation for ListBoxItems and look what the method returns:
protected override string GetItemTypeCore() { return string.Empty; }Well, for me this is a bug in the .NET Framework, but I'm afraid MS won't change the implementation due to backwards compatibility. Please, use one of the other AutomationProperties as a workaround...
Regards,
Alex
Ranorex Team
Re: Ranorex Spy cannot detect ItemType on WPF list items
Thanks for looking into it for me, reflection is a bit beyond me at the moment.
I figured it was an MS issue when Inspect failed to return the value, but I'm at a loss as to why anyone would implement it that way. One would think the idea of a list of different types of items (e.g. Files and Folders) would be obvious to WPF designers.
I figured it was an MS issue when Inspect failed to return the value, but I'm at a loss as to why anyone would implement it that way. One would think the idea of a list of different types of items (e.g. Files and Folders) would be obvious to WPF designers.
Michael Rollins