WPF DataGrid populating blank rows on TreeView's SelectedItemChanged
Posted
by
jes9582
on Stack Overflow
See other posts from Stack Overflow
or by jes9582
Published on 2011-01-11T16:44:02Z
Indexed on
2011/01/11
16:54 UTC
Read the original article
Hit count: 218
When my DataGrid populates on the TreeView's SelectedItemChanged event it finds the objects and creates the rows accordingly but the rows populate with no text or are just blank. So I know it is finding my objects but it is not displaying them properly. Does anyone see where I made an error or suggest any changes or fixes? Thank you in advance!
Here is the CSharp code that is setting the DataGrid's ItemsSource (I am using .dbml and LINQ with Lambda expressions):
dgSystemSettings.ItemsSource = (tvSystemConfiguration.SelectedItem as SYSTEM_SETTINGS_GROUP).SYSTEM_SETTINGS_NAMEs.Join(ssdc.SYSTEM_SETTINGS_VALUEs, x => x.SSN_ID, y => y.SSV_SSN_ID, (x, y) => new { SYSTEM_SETTINGS_NAME = x, SYSTEM_SETTINGS_VALUE = y });
And here is the .xaml:
<DataGrid Name="dgSystemSettings" AutoGenerateColumns="False" Height="447" Width="513" DockPanel.Dock="Right" ItemsSource="{Binding}" VerticalAlignment="Top" Margin="10,10,0,0">
<DataGrid.Columns>
<DataGridTextColumn x:Name="colDisplayName" Header="Name" Binding="{Binding SSN_DISPLAY_NAME}"></DataGridTextColumn>
<DataGridTextColumn x:Name="colValue" Header="Value" Binding="{Binding SSV_VALUE}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
© Stack Overflow or respective owner