DataGrid displays lengths of strings instead of the actual strings
Colleagues,
Familiarizing myself with DataGrid (and with C# in general). My DataGrid is declared like this:
Code:
<my:DataGrid AutoGenerateColumns="True" Margin="74,32,68,103" Name="dataGrid1" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" />
I’m setting the ItemSource property equal to a list of strings.
Code:
public Window1()
{
InitializeComponent();
List<string> lstGridData = new List<string>();
for (int i = 0; i < 8; ++i) lstGridData.Add("str");
dataGrid1.ItemsSource = lstGridData;
}
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”.
What did I miss?
Cheers,
- Nick
Update: some light was shed on this problem in this thread: http://www.codeproject.com/Messages/...ead-of-th.aspx