开发者

C# Newbie: Change Entity Framework DataBound DataGrid created with WPF drag-and-drop

开发者 https://www.devze.com 2023-03-16 17:48 出处:网络
I\'m new to C# and I created a WPF GUI using Visual Studio 2010 Ultimate (Windows 7 x64). I used drag-and-drop technology to databind a datagrid to an SQL Server 2开发者_如何转开发008 database table

I'm new to C# and I created a WPF GUI using Visual Studio 2010 Ultimate (Windows 7 x64).

I used drag-and-drop technology to databind a datagrid to an SQL Server 2开发者_如何转开发008 database table using Entity Framework technology.

This all works very well, despite my lack of C# skills.

I was able to hide columns using statements like:

dataGridInputEmails.Columns[0].Visibility = Visibility.Hidden;

And I cleared the datagrid using:

dataGridInputEmails.Columns.Clear();

Now I want to populate the datagrid with a string that I created by reading in a text file and using:

string[] parts = slurp.Split(delimiters,StringSplitOptions.RemoveEmptyEntries);

But, I cannot figure out how to populate the datagrid.

TIA


Try this:

dataGridInputEmails.ItemsSource = parts;

You shouldn't have to do dataGridInputEmails.Columns.Clear(); first.

0

精彩评论

暂无评论...
验证码 换一张
取 消