October 17th, 2009, 09:17 PM
DataGrid displays lengths of strings instead of the actual strings
Familiarizing myself with DataGrid (and with C# in general). My DataGrid is declared like this:
I’m setting the ItemSource property equal to a list of strings.
<my:DataGrid AutoGenerateColumns="True" Margin="74,32,68,103" Name="dataGrid1" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" />
I’m expecting that grid would display one column and each line would show “str”. Instead, the grid displays one column titled “Length” and each line displays “3”.
List<string> lstGridData = new List<string>();
for (int i = 0; i < 8; ++i) lstGridData.Add("str");
dataGrid1.ItemsSource = lstGridData;
What did I miss?
Update: some light was shed on this problem in this thread: http://www.codeproject.com/Messages/...ead-of-th.aspx
Last edited by kender_a; November 18th, 2009 at 03:21 AM.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.