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

Node is selected but not highlighted

5 Answers 235 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Justin Lee
Top achievements
Rank 1
Justin Lee asked on 09 Nov 2010, 04:44 PM
I have a Treeview that is bound to a list.  I am using a containerbinding to set IsExpanded and IsSelected.  I set the property for IsSelected to True on one of my items.

After setting the itemssource of the treeview, the correct item is selected - but it is not highlighted. i.e. there is a light gray border around the item, but it does not have the yellow background color that you get when you click on a node.  So it seems the node is selected, but is not active.  How do I get the node to be highlighted?

Thanks,
Justin

5 Answers, 1 is accepted

Sort by
0
Accepted
Petar Mladenov
Telerik team
answered on 10 Nov 2010, 04:07 PM
Hello Justin Lee,

It appears that the Silverlight Application isn't focused initially. Therefore, you have to manually focus it like so:

private void UserControl_Loaded(object sender, RoutedEventArgs e)
       {
           System.Windows.Browser.HtmlPage.Plugin.Focus();
       }

I`ve prepared a sample project demonstrating a binding to the IsSelected RadTreeViewItem property with ContainerBindings and the mentioned "tricky" code. Please examine it and let me know if it satisfies you.

Best wishes,
Petar Mladenov
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
Bala
Top achievements
Rank 1
answered on 19 Mar 2012, 01:37 PM
hi ,



 Is there option to Highlight  a node text  in tree view programatically .? with radtreeview ?




sbala
0
Petar Mladenov
Telerik team
answered on 19 Mar 2012, 02:26 PM
Hello Bala,

 Usually, playing with focus in Silverlight is tricky. However, there are cases in which you are able to focus a UIElement successfully. You can get a particular RadTreeViewItem in various ways:

1) If it is defined in XAML and has x:Name - access it with this.itsXName
2) If it is generated after binding - use RadTreeView.ItemContainerGenerator.ContainerFromItem() or ContainerFromIndex() methods
3) If it is generated after binding, and you know the Path to it - use RadTreeView.GetItemByPath(string path)

Once you have accessed the RadTreeViewItem, you can try calling its Focus() method.
Please let us know if this helped you.

Greetings,
Petar Mladenov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Bala
Top achievements
Rank 1
answered on 20 Mar 2012, 07:40 AM
Hi  Petar Mladenov,


  i'm not able to highlight the expanded node and i used binding source from sql . after binding the source. while i search for a particular node i m able to epand the node but couldn't highlight the text.
 i tried
Ex:
string path = "RootNode\\ParentNode"

radtv.ExpandItemByPath(path,

 

"|");

 

radtv.GetItemByPath(path,

 

"|");

 

radtv.Focus();


But this doesn't work, am i making any mistake in this ?


Plz provide the solution for this.
i tried in xml as datasource too .i have the same isuue in that too.(Highlighting the Text).


if possible make static treeview sample example with highlighting text property.

Looking for the Solz,
Balas

0
Petar Mladenov
Telerik team
answered on 23 Mar 2012, 07:37 AM
Hello Bala,

 I hope the answers in these post have helped you. Please let us know if you need further assistance.
Bind RadTreeView To XML
Multiple Tree Nodes remain Highlighted

Regards,
Petar Mladenov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
TreeView
Asked by
Justin Lee
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Bala
Top achievements
Rank 1
Share this question
or