My WPF app have one MainWindow.xaml
and it contains several DataGrid
which is bind to ObservableCollection
in MainWindow.xaml.cs
.
For example,
public MainWindow()
{
var dg1 = new ObservableCollection<CustomClass1>();
var dg2 = new ObservableCollection<CustomClass2>();
var dg3 = new ObservableCollection<CustomerClass3>();
}
Problem is MainWindow.xaml
is getting longer and longer as I keep adding new DataGrid
in it.
Can I separate each DataGrid
to UserControl
or Page
?
Or do you know better solution for handling several DataGrid
in WPF app?
Thanks in advance!