Problem with mouse event on a user control (wpf).
- by csciguy
All,
I have a user control, defined as follows.
<UserControl x:Class="IDOView.AnimatedCharacter"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:IDOView"
mc:Ignorable="d"
Background="Transparent"
>
<Image Name="displayImage" Height="Auto" Width="Auto" Stretch="Fill" IsHitTestVisible="True"/>
The control is added to a main page twice, as follows.
<local:customControl x:Name="A1" Height="259" Width="197" DisplayImage="circle.png" Canvas.Left="-279" Canvas.Top="-56" MouseLeftButtonUp="DoA1">
<local:customControl x:Name="A1" Height="259" Width="197" DisplayImage="square.png" Canvas.Left="-209" Canvas.Top="-56" MouseLeftButtonUp="DoA2">
Essentially, about half of the circle is behind the square.
I need the square image in this case to pass through events to the circle behind it. The square has an element cut out of it (transparent). What is happening now is that the circle event only registers if I click on the region that is not covered by the square. Surely there has to be a way to bubble this event, or click-through?