Home Forums WPF controls Xceed DataGrid for WPF Get CurrentItem in ResourceDictionary code behind?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #24849 |

    I’ve got a custom CardView control template defined as a ResourceDictionary in my WPF application (hope that makes sense).

    Then I have a button defined in a DataCell on each “card” (row) in the ResourceDictionary, that when clicked, will perform some operations on the data contained in the current row. I’ve got a event defined that fires when the button is clicked but I’m not sure how to get the grid’s CurrentItem property so that I know which row the button was clicked for.

    How can I get the currently selected item in the code behind of the Resource Dictionary?

    Imported from legacy forums. Posted by brent (had 877 views)

    Xceed Support
    Member
    Post count: 5658

    The DataGridControl.ParentDataGridControl attached property can be used to access the parent DataGridControl for any row/cell object…

    typical usage:

    DataGridControl parentGrid = DataGridControl.GetParentDataGridControl( myCell );
    if( parentGrid != null)
    {
    //do stuff
    }

    Imported from legacy forums. Posted by Marcus [Xceed] (had 2641 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.