How to bind WPF Datagrid to a joined table

前端 未结 2 1219
逝去的感伤
逝去的感伤 2021-01-21 10:58

I have a big problem. I try to bind my WPF DataGrid to a table, created with inner join. I have created a class for the info to convert successfully:



        
2条回答
  •  说谎
    说谎 (楼主)
    2021-01-21 11:41

    The code that you presented seems ok - it doesn't matter how an object is created - what matters is the object itself.

    Rather than showing us this, you should show the xaml.

    One more thing - are we talking about DataGridView from winforms or rather the one that comes with WPF Toolkit ?

    =======================================

    Sorry. I've missed it in the first place - you don't have properties in your class! You've created public fields instead of properties and that's probably the problem.

    The code should look like this:

     public class NeshtoSi
    {
        public NeshtoSi() { }
    
        public string ssn{get; set;}
        public string name{get; set;}
        public string surname{get; set;}
    }
    

提交回复
热议问题