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
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
Is there option to Highlight a node text in tree view programatically .? with radtreeview ?
sbala
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.
Petar Mladenov
the Telerik team
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
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
Petar Mladenov
the Telerik team