This is a migrated thread and some comments may be shown as answers.

Asserting on RadComboItem's tooltip is not working as expected.

3 Answers 114 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Abilash
Top achievements
Rank 1
Abilash asked on 28 Mar 2016, 09:57 AM
I tried getting tooltip value from comboitems using AutomationElement, it is giving 'RadComboBoxItem' as value of tooltip in all cases irrespectivie of value in tooltip. 

    Here is the sample application code:

<telerik:RadComboBox Height="17" HorizontalAlignment="Left" Margin="260,84,0,0" Name="StaticComboCtrl" VerticalAlignment="Top" Width="156" ItemsSource="{Binding}" RenderTransformOrigin="0.494,-1.5">
                        <telerik:RadComboBoxItem AutomationProperties.HelpText="ItemOne" ToolTip="ItemOne">Item1</telerik:RadComboBoxItem>
                        <telerik:RadComboBoxItem AutomationProperties.HelpText="ItemTwo" ToolTip="ItemTwo">Item2</telerik:RadComboBoxItem>
                        <telerik:RadComboBoxItem AutomationProperties.HelpText="ItemThree" ToolTip="ItemThree">Item3</telerik:RadComboBoxItem>
                        <telerik:RadComboBoxItem AutomationProperties.HelpText="ItemFour" ToolTip="ItemFour">Item4</telerik:RadComboBoxItem>
                        <telerik:RadComboBoxItem AutomationProperties.HelpText="ItemFive" ToolTip="ItemFive">Item5</telerik:RadComboBoxItem>
                        <telerik:RadComboBoxItem AutomationProperties.HelpText="ItemSix" ToolTip="ItemSix">Item6</telerik:RadComboBoxItem>
                    </telerik:RadComboBox>



Below is the code which gets autiomation element from point and gets "HelpText" property from that control. 

                System.Windows.Automation.AutomationElement testControl = AutomationElement.FromPoint(LocationOfTheCombItem or mouse position); 

                testing = testControl.Current.HelpText;



Here variable testing is always populated with value "RabComboBoxItem" but not actual value. 



Any help would be highly appreciated in this regards. 



3 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 28 Mar 2016, 02:45 PM
Hello ,

We were able to reproduce the described behavior and we can confirm that this is an issue of the RadComboBoxItem automation peer. Furthermore, we were able to pinpoint the exact location and therefore if everything goes as expected the fix could be available in one of the next internal builds.

Nevertheless, if you are in a CodedUI test you can use the ToolTip property of the WpfRadComboBoxItemControl class (you can observe it if you use for example the recorder and add verification on the ComboBoxitem as you will need the extensions described in this help article).

as a you could override the GetHelpThest method of the RadComboBoxAutomationPeer. In order to do that you will need:
  • Create custom class that inherits the RadComboBoxAutomationPeer and override the GetHelpText method as you can use something like this:

var toolTip = this.RadComboBoxItemOwner.ToolTip;
if (toolTip != null && toolTip.ToString() != string.Empty)
{
    return toolTip.ToString();
}
 
return "RadComboBoxItem";

  • Create  class that inherits RadComoboBoxItem and override the OnCreateAutomationPeer method so you can return the custom automation peer.
  • Use the custom RadComboBoxItems instead of the regular ones.


Hope this would help.


Regards,
Georgi
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Dharmavaram
Top achievements
Rank 1
answered on 19 May 2016, 09:48 AM

Even i faced the same issue when i tried to get the HelpText of RadComboBoxItem. I wanted to know if the new build has been released. Also,i tried to get the ToolTip in a similar fashion as suggested by you in CodedUITest.

It works fine when the tooltip is added in the following way. 

 <telerik:RadComboBoxItem  Content="Item 1"  ToolTip="item1"/>

However,it doesnot seems to work when it is done in the other way.

<telerik:RadComboBoxItem Content="Item 3" telerik:RadToolTipService.ToolTipContent="Item3" />

Any help in this regard would be appreciated.

0
Georgi
Telerik team
answered on 20 May 2016, 07:37 AM
Hello Dharmavaram,

The fix is available in the latest official release Q2 2016. Indeed with the current implementation of the control it supports only the FrameworkElement.Tooltip property. However we plan to investigate it further and also try to add support for the RadToolTipService as well.

Nevertheless if you have override for the GetHelpText method you can get the value of the RadToolTipService.Content as shown below:

RadComboBoxItemOwner.GetValue(RadToolTipService.ToolTipContentProperty)

Hope this would help.

Regards,
Georgi
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
ComboBox
Asked by
Abilash
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Dharmavaram
Top achievements
Rank 1
Share this question
or