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.
精彩评论