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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set focus

Thread ID:

Created:

Updated:

Platform:

Replies:

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

Hello
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
}
else
{
SetFocus(item.Child, itemToFocus);
}
Goodbye



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; 
                        treeGrid.InternalGrid.SelectedNodes.Add(node); 
                        
                    } 
                } 
                 
            } 
            treeGrid.InternalGrid.ReloadNodes(); 
 
         } 
 
Regards, 
Jai Ganesh S 


CONFIRMATION

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.

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

;