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

4 posts, 0 answers
  1. Abilash
    Abilash avatar
    1 posts
    Member since:
    Jun 2014

    Posted 28 Mar Link to this post

    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>

    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. 

  2. Georgi
    Georgi avatar
    344 posts

    Posted 28 Mar Link to this post

    Hello Abilash,

    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).

    Also as a workaround 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 custom 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.

    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. DevCraft banner
  4. Dharmavaram
    Dharmavaram avatar
    70 posts
    Member since:
    Jun 2013

    Posted 19 May in reply to Georgi Link to this post

    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.

  5. Georgi
    Georgi avatar
    344 posts

    Posted 20 May Link to this post

    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:


    Hope this would help.

    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top