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

SelectedRowChanged

Thread ID:

Created:

Updated:

Platform:

Replies:

123315 Mar 7,2016 01:41 PM UTC Mar 10,2016 01:50 AM UTC WPF 3
loading
Tags: GridTreeControl
IOANNIS VINIS
Asked On March 7, 2016 01:41 PM UTC

Can you help me.

I can't find the SelectedRowChanged event.

Thanks

Gnanasownthari Thirugnanam [Syncfusion]
Replied On 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.

IOANNIS VINIS
Replied On 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

Jai Ganesh S [Syncfusion]
Replied On 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


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

;