I have a WPF application where i use Frame to load Page‘is. On the Page i call my custom contol <Controls:OrderDataGrid x:Name="cntrlOrderDataGrid" />.
On this control i have DataGrid what is filled with data when i navigate to the Page inside the Frame. Sometimes the loading takes a while and i need to know when the DataGrid finishes loading, so i have set the Loaded event:
private void dgOrders_Loaded(object sender, RoutedEventArgs e)
{ }
But i cant figure out could i notify the MainWindow that the DataGrid has ended loading. When i set the Loaded event to the Frame then its fired right away without waiting for my custom control with datagrid.
You need to effectively pass the event up.
The
Pagethat holds the datagrid needs to add a new event; something likeOrdersLoaded. When the datagrid finishes loading fire that event. The main window can then subscribe to that event, thus telling it when the orders are loaded.