Completed
Last Updated: 21 Aug 2020 12:32 by ADMIN
Release R3 2020 (LIB 2020.2.826)
dev
Created on: 04 Aug 2020 08:20
Category: CommandBar
Type: Bug Report
0
RadCommandBar: CommandBarDropDownList ToolTipText is always the text of the first item in the list

Hi,

I have a CommandBar that contains multiple CommandBarDropDownLists. When they get shown, the tooltip is supposed to be the selected item's text. What actually happens though is that the tooltip is basically always the text of the first item in the list. I've tried several things, to no avail. Some of the things I've tried include overriding the VisualItemFormatting event of the CommandBarDropDownLists, working with the TextChanged event to change the tooltip, and trying to change the tooltip in the SelectedIndexChanged event that is also being overriden for other purposes as well. None of these has changed the behaviour described above.

Thank you in advance for your time! I know this is probably simple and I am just missing something, but I just can't figure it out.

Best regards,
Matei

3 comments
ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 04 Aug 2020 10:28

Hi, Matei,

Indeed, if you change the DropDownStyle to DropDownList, the editable area wouldn't contain a text box and the tool tip should be extracted from the RadDropDownListEditableAreaElement. An alternative approach is to extract the text from the SelectedItem

    Sub New()

        InitializeComponent()

        Me.CommandBarDropDownList1.SelectedIndex = 2
        Me.CommandBarDropDownList2.SelectedIndex = 1
        Me.CommandBarDropDownList1.AutoToolTip = True
        Me.CommandBarDropDownList2.AutoToolTip = True

        Me.CommandBarDropDownList1.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList
        AddHandler Me.RadCommandBar1.ToolTipTextNeeded, AddressOf CommandBar_ToolTipTextNeeded
    End Sub

    Private Sub CommandBar_ToolTipTextNeeded(sender As Object, e As Telerik.WinControls.ToolTipTextNeededEventArgs)
        Dim textBox As RadTextBoxItem = TryCast(sender, RadTextBoxItem)
        If textBox IsNot Nothing Then
            e.ToolTipText = textBox.Text
        End If

        Dim editableArea As RadDropDownListEditableAreaElement = TryCast(sender, RadDropDownListEditableAreaElement)
        If editableArea IsNot Nothing Then
            Dim dropDown As RadDropDownListElement = editableArea.FindAncestor(Of RadDropDownListElement)()
            If dropDown IsNot Nothing AndAlso dropDown.SelectedItem IsNot Nothing Then
                e.ToolTipText = dropDown.SelectedItem.Text
            End If
        End If

    End Sub

Feel free to use this approach which suits your requirements best. We will consider both of the DropDownStyle modes when addressing this item. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

dev
Posted on: 04 Aug 2020 10:14

Hi Dess,

Thanks for the quick reply once again!
Your solution did work, however I wanted to mention that the way you present it only works if the DropDownStyle of the DropDownList is set to DropDown. We have to use DropDownStyle.DropDownList to not allow users to edit, so I had to cast the sending object to a RadDropDownListEditableAreaElement instead, and used its AccessibleDescription property to set the text (can't see any code snippet insert so I'll just type it out): 

Private Sub CommandBar_ToolTipTextNeeded(sender as Object, e as TOolTipTextNeededEventArgs)
    Dim editableElement = TryCast(sender, RadDropDownListEditableAreaElement)
    If editableElement IsNot Nothing Then

        e.ToolTipText = editableElement.AccessibleDescription
    End If
End Sub

You could use other properties to get the tooltip information/text from I guess, but this one works great for our purposes. 
Thank you once again! Have a nice day!

Best regards,
Matei

ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 04 Aug 2020 09:19
Hello, Matei,

Following the provided information, I was able to replicate the undesired behavior with the wrong tool tip once a new item is selected in the drop down. Here is my code and the wrong result is illustrated in the attached gif file: 
    Sub New()
         
        InitializeComponent()

        Me.CommandBarDropDownList1.SelectedIndex = 2
        Me.CommandBarDropDownList2.SelectedIndex = 1
        Me.CommandBarDropDownList1.AutoToolTip = True
        Me.CommandBarDropDownList2.AutoToolTip = True
    End Sub

I have logged it in our feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to handle the RadCommandBar.ToolTipTextNeeded event and specify the exact tool tip text to be displayed: 

    Sub New()

        InitializeComponent()

        Me.CommandBarDropDownList1.SelectedIndex = 2
        Me.CommandBarDropDownList2.SelectedIndex = 1
        Me.CommandBarDropDownList1.AutoToolTip = True
        Me.CommandBarDropDownList2.AutoToolTip = True

        AddHandler Me.RadCommandBar1.ToolTipTextNeeded, AddressOf CommandBar_ToolTipTextNeeded
    End Sub

    Private Sub CommandBar_ToolTipTextNeeded(sender As Object, e As Telerik.WinControls.ToolTipTextNeededEventArgs)
        Dim textBox As RadTextBoxItem = TryCast(sender, RadTextBoxItem)
        If textBox IsNot Nothing Then
            e.ToolTipText = textBox.Text
        End If 
    End Sub

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Attached Files: