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. Image for the cookie policy date

SelectedRowChanged

Can you help me.

I can't find the SelectedRowChanged event.

Thanks

3 Replies

GT Gnanasownthari Thirugnanam Syncfusion Team March 8, 2016 01:20 PM UTC

Hi Ioannis,

You can achieve your requirement using SelectionChanged event. Find the code snippet for the same,

this.treeGrid.Model.SelectionChanged += Model_SelectionChanged;

void Model_SelectionChanged(object sender, GridSelectionChangedEventArgs e)

        {

           

            //You can get selected node using below properties.

            //treeGrid.SelectedNode

            //treeGrid.SelectedNodes


            //You can get range from e.Range

            //e.Range
        }


Please let me know if you have any other concerns,

Regards
Gnanasownthari T.


IV IOANNIS VINIS March 8, 2016 02:21 PM UTC

Thanks for your answer.

I have the following classes

Public Category
{
    public Int64 Id { get; set; }
    public string Name { get; set; }

   public Int64? Parent_CategoryId { get; set; }
    public virtual Category Parent_Category { get; set; }

    public virtual ICollection<Item> Items { get; set; }
    public virtual ICollection<Category> Child_Categories { get; set; }    
}
public class Item
{
    public Item()
    {
    }

    public Int64 Id { get; set; }

    public string Name { get; set; }

    public Int64 CategoryId { get; set; }
    public virtual Category Category { get; set; }
}

I have a form with the following controls
1) <GridTreeControl x:Name="gdCategories" ItemsSource="{Binding Categories}" ChildPropertyName="Child_Categories" />
2) <GridDataControl x:Name="gdCategoryItems" />

I load the items from db and I bind the items to view (this.DataContext = new { Categories = dbCategories };

The tree items are displayed ok.
I want every time i click on new row on GridTreeControl to bind the selected Category.Items to GridDataControl
How can I achieve this in XAML binding (only binding without events).

Thanks


JG Jai Ganesh S Syncfusion Team March 10, 2016 01:50 AM UTC

Hi Ioannis,


From your query, you want the set the SelectedItem in GridDataControl based on the GridTreeControl SelectedItem.  You cannot achieve this requirement through xaml binding and you can achieve this in code behind by using SelectionChanged event.


Code Snippet:

void InternalGrid_SelectionChanged(object sender, GridSelectionChangedEventArgs e)

 {

      var node = this.treeGrid.SelectedNode;

      var data= (node as GridTreeNode).Item;

      this.griddatacontrol.SelectedItem = data;

  }


Sample: http://www.syncfusion.com/downloads/support/directtrac/144013/ze/GridTreeDemo1156251254


Regards,

Jai Ganesh S


Loader.
Up arrow icon