In my wpf application, I have a Usercontrol in a wpf window which is a part of another module.This parent Usercontrol is having another two child user controls in it. These two child usercontrol is loading data from two different CSV files and shows graphs on each usercontrol. When the main window loads, these two usercontrols loads data from these 2 csv files and display the graphs. But the problem is, this process is taking too much time and the window will become non responsive.
I want to have a loading adorner (like loading....please wait) on the screen and the UI will be responsive. When the 2 usercontrols loaded the graphs properly, the Loading adorner will be gone. Could any one please share the code for this ??
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center" Height="30" Width="Auto">
<TextBlock Text="Your Name " FontFamily="Verdana" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="12" FontWeight="Bold" />
<ComboBox Name="cboName" ItemsSource="{Binding GraphStringType}" Height="25" Width="300" HorizontalAlignment="Center" VerticalAlignment="Center" Focusable="False"
IsTextSearchEnabled="True" StaysOpenOnEdit="True" IsReadOnly="True" IsEditable="True" Text="-- Select your Name --">
<ComboBox.ItemTemplate>
<DataTemplate>
<CheckBox Width="100" Height="23" Content="{Binding}" IsChecked="{Binding IsChecked}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<Grid Name="graphGrid" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto" />
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<useCtrl:UsrCtrlGraphUI x:Name="graph1" GraphFilePath="{Binding FileNameWithPath}" Grid.Column="0" Height="Auto" Width="Auto" />
<GridSplitter HorizontalAlignment="Stretch" ResizeDirection="Columns" ResizeBehavior="PreviousAndNext"
VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="1" Width="5" Background="Silver">
</GridSplitter>
<useCtrl:UsrCtrlGraphUI x:Name="graph2" GraphFilePath="{Binding FileNameWithPath}" Grid.Row="1" Grid.Column="2" Height="Auto" Width="Auto" />
</Grid>
The loading data from the 2 csv files is a very huge task and it causes non responsive UI. How to set a loading adorner over the window and the UI becomes responsive ?