This is a migrated thread and some comments may be shown as answers.
TreeView Node Does Not Remain Highlighted
9 Answers 97 Views
This is a migrated thread and some comments may be shown as answers.
Paul Patterson
Top achievements
Rank 1
Paul Patterson asked on 03 Nov 2010, 08:46 PM
We have a scenario where, a user will select a Treeview node in which we perform logic within theSelectedNodeChanging event. Using e.Node we are able to validate that the node being selected is the correct node. However after performing logic in using the SelectedNodeChanging event, the newly selected node does not show as highlighted in the treeview. 

We have validated that the clicked node is in fact the selected node in the treeview, however it simply does not show it as selected by being highlighted. The code we are using, within the SelectedNodeChanging event includes a user confirmation via a RadMessageBox. It seems that the coloured highlighting of the selected node disappears when the message box is called; almost as if it is not highlighted because it is loosing focus. Once the messagebox is closed, we need the selected node to remain highlighted.

What is also interesting is that the selected node, while not highlighted, does not change style when hovering over it with the mouse. All other nodes change style on hover, but not the selected node - it remains plain.

Are we missing something? Is there something else that we have initialize or call to show the node (e.node) highlighted?

9 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 03 Nov 2010, 10:08 PM
Hi again Paul,

As you said in the other post that you are not calling e.Cancel, and that you are using the latest version, please can you post the code that you are using in this event, and any other relevant code, In the meantime, I'll see if I can replicate it.

Regards,
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 04 Nov 2010, 05:34 PM
Hi Paul, 

Just to let you know that I haven't been able to replicate this. 
Please can you post the code to show how you have your treeview configured and the code from the SelectedNodeChanging event if you are still having an issue. 

Thanks
Richard
0
Paul Patterson
Top achievements
Rank 1
answered on 04 Nov 2010, 08:43 PM
Sorry Richard, I am not at liberty to post our code. 

The problem has been isolated to that of the use of a RadMessageBox within the code. The message box opens, and a dialog response is provided and the message box is closed. Again, it appears that the treeview node is selected, however it is simply not highlighted - almost as if the control (treeview) is not being painted with the highlight style. When hovering over the node, nothing happens, not even a highlight Yet when I hover over other nodes the expected highlighting occurs.

Is there a property that can set manually, or a method that can be called to set the highlighting on the selected node?

Thanks anyway,

Paul
0
Richard Slade
Top achievements
Rank 2
answered on 04 Nov 2010, 09:12 PM
Hi Paul,

It's very tricky to try and find a solution without knowing what exactly you are doing in this method. I have tried launching a radMessageBox from this event handler and it makes no difference to the node showing as highlighted. See below...
Private Sub RadTreeView1_SelectedNodeChanging(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.RadTreeViewCancelEventArgs) Handles RadTreeView1.SelectedNodeChanging
    If RadMessageBox.Show(e.Node.Text) = Windows.Forms.DialogResult.OK Then
        ' do something
    End If
End Sub


If you could post a similar exmaple, without it being your actual code (a replica project) then that would help me to assist you.

Many thanks
Richard
0
Svett
Telerik team
answered on 09 Nov 2010, 06:13 PM
Hi Guys,

@Richard: Thank you for your community effort in our forums.
@Paul Patterson: The node lose its highlight color, because your are showing a form inside the SelectedNodeChanging event. The highlight style is defined when the mouse is over the node.

Greetings,
Svett
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Paul Patterson
Top achievements
Rank 1
answered on 09 Nov 2010, 07:00 PM
Thanks @Svett, however you misunderstood what the issue is.

Normally if you select (click) a node, the node becomes styled to indicate it is selected. However when opening and closing a RadMessageBox within the SelectedNodeChanging event the selected node does not remain styled. It's not an issue of hovering over the node, it's an issue of the selected node not retaining it's style after using a MessageBox within the event. 

For what it's worth, I've attached the following screen shots for your reference:

  • 1_FirstSelectedNode.jpg - shows the state of the treeview before calling the SelectedNodeChanging event.
  • 2_MessageBoxInEvent.jpg - shows the messagebox being displayed.
  • 3_NewlySelectedNode.jpg - shows state of the treeview when the message box is closed with a response. Note that the "Test Asset Type 1" node is the node that should show as selected (styled) however it does not. Debugging the code in the event indicates that the new node is selected (as per e.Node). When I hover over the nodes above and below the selected node, they get styled with a highlight. If I hover over the selected node, it remains as it is, with no highlighting.

If I don't call the message box then I don't have the problem however we need some user validation before proceeding with  the selection of another node. 

Cheers,

Paul
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 09 Nov 2010, 09:17 PM
Hi Paul,

Thanks for the screenshots. This helps a great deal. I see that from the screenshots it looks like you are using the Telerik theme. I have managed to reproduce your issue but only using the Telerik Theme.

The Telerik theme is an old theme created before they presented the new theming mechanism and the new Visual Style Builder tool.

I suggest that in this case you take a look at creating your own theme for the TreeView using the Visual Style Builder

Please can you confirm this by trying your code when placing the RadTreeView into a different theme. For example, the default one.

thanks - hope that helps
Richard
0
Paul Patterson
Top achievements
Rank 1
answered on 09 Nov 2010, 10:40 PM
@Richard, you rock! 

That did the trick. I changed the theme to another (Office2007Black) and presto, it worked! 

Thanks for the tip. 

Cheers,

Paul
0
Richard Slade
Top achievements
Rank 2
answered on 09 Nov 2010, 11:28 PM
Excellent! Really glad that worked for you Paul.
All the best
Richard
Asked by
Paul Patterson
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Paul Patterson
Top achievements
Rank 1
Svett
Telerik team
Share this question
or