So i Got a tmplist of ObservableCollection in which i got few elements.
I connect it to the ItemsSource of DataGrid in WPF 4.0 and it doesn't show anything. Doesn't add any colums. If I add breakpoint I can see that the "ItemsSource count equals quantity of tmplist elements, but the Columns count equals 0. Why is that? Here is some code:
private ObservableCollection<Products> tmplist = new ObservableCollection<Products>();
public Products_view()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(Products_view_Loaded);
}
void Produkty_widok_Loaded(object sender, RoutedEventArgs e)
{
grid.ItemsSource = tmplist;
}
and xaml:
<DataGrid Name="grid" CurrentCellChanged="grid_CurrentCellChanged" CellEditEnding="grid_CellEditEnding" RowEditEnding="grid_RowEditEnding" AlternatingRowBackground="#FFA0D1EA" AlternationCount="1" Background="#FF64A0BE" RowBackground="White" />