I have a WPF window where the background is {x:Null} and AllowTransparency=True
<Window x:Class="ClickThrough"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="SeeThru" Height="200" Width="200"
Topmost="True"
WindowStyle="None"
AllowsTransparency="True"
Background="{x:Null}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="80"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<Border Background="CadetBlue" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
CornerRadius="5,5,0,0" Margin="-1,0,-1,0" MouseLeftButtonDown="DragWindow">
</Border>
<Grid MouseLeftButtonUp="UIElement_OnMouseLeftButtonUp" Grid.Row="1"></Grid>
</Grid>
</Window>
I can click on the 'window' and the click passes through the window and the underlying application receives it. This is perfect. However I also want to be able to handle the click event and then allow it to pass-through to the underlying application.
The event handler on the inner Grid doesn't register the events.
private void UIElement_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
Console.WriteLine("clicked");
e.Handled = false;
}
If I change the Background in the inner grid to a color.
<Grid MouseLeftButtonUp="UIElement_OnMouseLeftButtonUp" Grid.Row="1" Background="Aqua">
Now the event is received, however the click does not bubble through to the underlying application even thought the handled is set to false.
Is this possible?