We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set focus

Thread ID:





123807 Apr 22,2016 02:04 PM UTC Apr 26,2016 03:41 AM UTC WPF 1
Tags: GridTreeControl
Asked On April 22, 2016 02:04 PM UTC

I dont know how to set focus to gridtreeview element;
I have a loop in collection of binded elemnt(ItemsSource) in view model.
I found searching element but i dont know how to set focus.
private void SetFocus(ObservableCollection findItems, string itemToFocus)
foreach (var item in findItems)
if (item.ID == itemToFocus)
//here i found the node and i neeed to set focus in treegridview to him
SetFocus(item.Child, itemToFocus);

Jai Ganesh S [Syncfusion]
Replied On April 26, 2016 03:41 AM UTC

Hi Lukasz, 
You can achieve your requirement for select the specific node by using the below code example,

Code Example [C#]:


  private void Button_Click(object sender, RoutedEventArgs e) 
            foreach(var node in treeGrid.InternalGrid.Nodes) 
                for (int i = 0; i < node.ChildNodes.Count;i++ ) 
                    if ((node.ChildNodes[i].Item as EmployeeInfo).EmpID == 1008) 
                        if (node.HasChildNodes) 
                            node.Expanded = true; 
                        node.ChildNodes[i].IsSelected = true; 
Jai Ganesh S 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon