Hope you can help.
I am continuing to try and learn WPF and my current test project (which I have simplified significantly to demonstrate my problem) is to display an Adorner on a window when a button is clicked to open a new Window. When this window is displayed the Adorner is hidden.
My problem is the Adorner is not displaying.
Code for all but the Adorner below (for the purpose of this test Adorner style can be anything)
MainWindow Xaml
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="300"/>
</Grid.RowDefinitions>
<Button Grid.Row="0" Click="OnCreateNewWindow" Content="Create new Window1" Width="150"/>
<ad:AdornedControl Grid.Row="1" Name="LoadingAdorner" >
<ad:AdornedControl.AdornerContent>
<local:WorkInProgress/>
</ad:AdornedControl.AdornerContent>
</ad:AdornedControl> </Grid>
MainWindow Xaml.cs
MainWindow Xaml.cs
private void OnCreateNewWindow(object sender, RoutedEventArgs e)
{
LoadingAdorner.ShowAdorner();
Thread.Sleep(3000);
Window1 w = new Window1();
w.Show();
LoadingAdorner.HideAdorner();
}
If I remove the HideAdorner the Adorner displays the instant the new Window displays.
How can I get the Adorner to display when the button is Clicked?
Thank you for your assistance.