Wpf: Dataset master-detail relationship in binding

.991 Net Wpf

I have a master and childtable with a relationship set in Sql Server. I imported both datasets to the designer, end the relationship was imported with it. I display the master table in a (telerik) grid with ItemsSource="{Binding UsersData}".

Usersdata

  var dtable := new AblKas2012.Dataset1.GebruikersDataTable();
  var adapter: AblKas2012.Dataset1TableAdapters.GebruikersTableAdapter := new AblKas2012.Dataset1TableAdapters.GebruikersTableAdapter();
  adapter.Fill(dtable);

  UsersData := dtable.DefaultView;

This works well, all data is displayed. But now I want to display the related rows from KasGebruikers. There is a relationship named ‘Admins’ which is used in the last method from the code generated below.

But whatever I try, I cannot get this relationship to work: I always get a bindingerror:

System.Windows.Data Error: 40 : BindingExpression path error: 'GetKasGebruikersRows' property not found on 'object' ''DataRowView' (HashCode=56247849)'. BindingExpression:Path=GetKasGebruikersRows; DataItem='DataRowView' (HashCode=56247849); target element is 'RadGridView' (Name='RadGridView1'); target property is 'ItemsSource' (type 'Object')

I tried some other names, but the standard fields work, the relationship does not… I am not a wizard in Wpf yet, so I might be doing something trivial wrong … (something with datarowview/datarow type etc???)

The designer generated this code:

    GebruikersRow nested in Dataset1  = public partial class(System.Data.DataRow)
    private 
        var tableGebruikers: GebruikersDataTable;
        method get_ID: System.Int32;
        method set_ID(value: System.Int32);
        method get_LoginName: System.String;
        method set_LoginName(value: System.String);
        method get_Fullname: System.String;
        method set_Fullname(value: System.String);
        method get_Password: System.String;
        method set_Password(value: System.String);
        method get_LastAccess: System.DateTime;
        method set_LastAccess(value: System.DateTime);
        method get_Enabled: System.Boolean;
        method set_Enabled(value: System.Boolean);
        method get_CreatedTime: System.DateTime;
        method set_CreatedTime(value: System.DateTime);
        method get_LastAccTime: System.DateTime;
        method set_LastAccTime(value: System.DateTime);
        method get_CreatedDate: System.DateTime;
        method set_CreatedDate(value: System.DateTime);
        method get_AccessCount: System.Int32;
        method set_AccessCount(value: System.Int32);
        method get_Gebruikersrol_id: System.Int32;
        method set_Gebruikersrol_id(value: System.Int32);
        method get_Afsluiter: System.Boolean;
        method set_Afsluiter(value: System.Boolean);
        method get_WachtwoordVerlopen: System.Boolean;
        method set_WachtwoordVerlopen(value: System.Boolean);
        method get_niveau: System.String;
        method set_niveau(value: System.String);
    assembly 
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        constructor(rb: System.Data.DataRowBuilder);
    public 
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        property ID: System.Int32 read get_ID write set_ID;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        property LoginName: System.String read get_LoginName write set_LoginName;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        property Fullname: System.String read get_Fullname write set_Fullname;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method IsFullnameNull: System.Boolean;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method SetFullnameNull;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        property Password: System.String read get_Password write set_Password;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method IsPasswordNull: System.Boolean;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method SetPasswordNull;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        property LastAccess: System.DateTime read get_LastAccess write set_LastAccess;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method IsLastAccessNull: System.Boolean;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method SetLastAccessNull;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        property Enabled: System.Boolean read get_Enabled write set_Enabled;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method IsEnabledNull: System.Boolean;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method SetEnabledNull;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        property CreatedTime: System.DateTime read get_CreatedTime write set_CreatedTime;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method IsCreatedTimeNull: System.Boolean;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method SetCreatedTimeNull;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        property LastAccTime: System.DateTime read get_LastAccTime write set_LastAccTime;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method IsLastAccTimeNull: System.Boolean;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method SetLastAccTimeNull;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        property CreatedDate: System.DateTime read get_CreatedDate write set_CreatedDate;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method IsCreatedDateNull: System.Boolean;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method SetCreatedDateNull;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        property AccessCount: System.Int32 read get_AccessCount write set_AccessCount;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method IsAccessCountNull: System.Boolean;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method SetAccessCountNull;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        property Gebruikersrol_id: System.Int32 read get_Gebruikersrol_id write set_Gebruikersrol_id;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method IsGebruikersrol_idNull: System.Boolean;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method SetGebruikersrol_idNull;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        property Afsluiter: System.Boolean read get_Afsluiter write set_Afsluiter;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method IsAfsluiterNull: System.Boolean;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method SetAfsluiterNull;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        property WachtwoordVerlopen: System.Boolean read get_WachtwoordVerlopen write set_WachtwoordVerlopen;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method IsWachtwoordVerlopenNull: System.Boolean;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method SetWachtwoordVerlopenNull;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        property niveau: System.String read get_niveau write set_niveau;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method IsniveauNull: System.Boolean;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method SetniveauNull;
        [System.Diagnostics.DebuggerNonUserCodeAttribute]
        [System.CodeDom.Compiler.GeneratedCodeAttribute('System.Data.Design.TypedDataSetGenerator', '4.0.0.0')]
        method GetKasGebruikersRows: array of KasGebruikersRow;
    end;

Oh, I now get it. Only properties are found so I have to create a property that returns the rows…