I have an items control on my window and when its double clicked I want to open a second window. My problem is that if the items control is wrapped in a scroll viewer the new window comes up behind the main window instead of in front of it. If comment out the scroll viewer in this code the window opens in front as intended.
Whats going on here?
Window XAML:
<Window x:Class="EktronDataUI.TestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TestWindow" Height="300" Width="300">
<Grid>
<ScrollViewer>
<ItemsControl ItemsSource="{Binding Source={StaticResource odpMockSmartForms}}" MouseDoubleClick="ItemsControl_MouseDoubleClick" >
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="Double Click Me" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Window>
Code Behind:
private void ItemsControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
TestWindow window = new TestWindow();
window.Show();
}