How can I bind a c#.net DataView (WPF) to a SQLite

2019-07-19 05:14发布

I am using the official System.Data.SQLite ADO.NET provider for my application, and I am trying to display the contents of a database in a WPF DataGrid. Currently I am able to select the data I need to display from the database, but I don't how to display that data on the datagrid.

I have search on the web, read blog posts, tutorials and guides, but to no avail. I am moving an application from a PHP system (using my local server) to a desktop application to be portable across systems. My current applications uses sqlite3 databases, and contains quite a few rows. This is why I would prefer to make sqlite work with c#, which is the desktop oriented language I am most comfortable with.

1条回答
贼婆χ
2楼-- · 2019-07-19 05:41

You should just have to Bind the column to the name of the field in the db.

<local:AutoGenerateColumn Column="ItemStatusId"
           Binding="{Binding Path=ItemStatusId}" />

Here's a link to a pretty good tutorial: http://www.codeproject.com/KB/WPF/DataGridAutoTemplate.aspx

查看更多
登录 后发表回答