Welcome to the Xceed Community Sign in | Join | Help
Community Search  

Detecting when the user changes row they are on

Sort Posts: Previous Next
  •  05-12-2008, 12:52 AM Post no. 12156

    Detecting when the user changes row they are on

    I have two DataGrids.

    An instance of  A contains a BindingList of B and each B has a BindingList of C.

    My first grid displays all B instances. I want the second grid to display the instances of C contained within the selected B.

    I have the first grid working fine. How do I update the second grid (ie display the instances of C related to the selected B in the first grid) when the user switches row on the first grid? I assumed there would be an event to catch on the grid - but I can't work out which to catch. (Or is there a better way?)

  •  05-12-2008, 8:12 PM Post no. 12188 in reply to 12156

    Re: Detecting when the user changes row they are on

    Bump.
  •  05-13-2008, 3:21 AM Post no. 12195 in reply to 12188

    Re: Detecting when the user changes row they are on

    You have to wire up a SelectedItemChanged event, which listens to the SelectedItemProperty of the grid

    DependencyPropertyDescriptor SelectedItemChangedDescriptor = DependencyPropertyDescriptor.FromProperty(DataGridControl.SelectedItemProperty, typeof(DataGridControl));
    SelectedItemChangedDescriptor.AddValueChanged(this, new EventHandler(OnSelectedItemChanged));

    private void OnSelectedItemChanged(object sender, EventArgs e)
    {

    //Do processing here

    }
     

    Cheerios,

    Serene 


    "ASCII and ye shall receive."
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.