Search code examples
wpfxamlwpfdatagrid

How to bind object on DataGridRow


In my DataGrid if I have the following binding I get the User_ID no problem. Each row is a User record. How do I change this to bind the actual User Object? So I can send it into my converter.

{Binding Path=DataContext.User_ID, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"

Solution

  • Try to remove .User_ID from binding path :

    {Binding Path=DataContext, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"