I have two InkCanvases
stacked and I'd like to get the top to pass inking to the bottom. I set the top to ishittestvisible=false
but it still receives the inking. Then as a test I set both to false
and the top still gets inking...what am I missing?
I created a blank project and it exhibits the same problem. Here's the code:
MainPage.xaml
<RelativePanel>
<StackPanel Name="stackPanelButtons" Orientation="Vertical">
<Button Name="buttonTop" Content="T" Height="50" Click="buttonTop_Click"/>
<Button Name="buttonBottom" Content="B" Height="50" Click="buttonBottom_Click"/>
<Button Name="buttonTopHit" Content="TH" Height="50" Click="buttonTopHit_Click"/>
<Button Name="buttonBottomHit" Content="BH" Height="50" Click="buttonBottomHit_Click"/>
</StackPanel>
<InkCanvas Name="inkCanvasBottom" RelativePanel.RightOf="stackPanelButtons" Width="500" Height="500"/>
<InkCanvas Name="inkCanvasTop" RelativePanel.RightOf="stackPanelButtons" Width="500" Height="500" Loaded="inkCanvasTop_Loaded"/>
</RelativePanel>
MainPage.cs
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private void buttonTop_Click(object sender, RoutedEventArgs e)
{
if(buttonTop.Content.Equals("T"))
{
inkCanvasTop.Visibility = Visibility.Collapsed;
buttonTop.Content = "t";
}
else
{
inkCanvasTop.Visibility = Visibility.Visible;
buttonTop.Content = "T";
}
}
private void buttonBottom_Click(object sender, RoutedEventArgs e)
{
if (buttonBottom.Content.Equals("B"))
{
inkCanvasBottom.Visibility = Visibility.Collapsed;
buttonBottom.Content = "b";
}
else
{
inkCanvasBottom.Visibility = Visibility.Visible;
buttonBottom.Content = "B";
}
}
private void buttonTopHit_Click(object sender, RoutedEventArgs e)
{
if (buttonTopHit.Content.Equals("TH"))
{
inkCanvasTop.IsHitTestVisible = false;
buttonTopHit.Content = "Th";
}
else
{
inkCanvasTop.IsHitTestVisible = true;
buttonTopHit.Content = "TH";
}
}
private void buttonBottomHit_Click(object sender, RoutedEventArgs e)
{
if (buttonBottomHit.Content.Equals("BH"))
{
inkCanvasBottom.IsHitTestVisible = false;
buttonBottomHit.Content = "Bh";
}
else
{
inkCanvasBottom.IsHitTestVisible = true;
buttonBottomHit.Content = "BH";
}
}
private void inkCanvasTop_Loaded(object sender, RoutedEventArgs e)
{
addInputs(inkCanvasTop);
addInputs(inkCanvasBottom);
}
private void addInputs(InkCanvas inkCanvas)
{
inkCanvas.InkPresenter.InputDeviceTypes = CoreInputDeviceTypes.Pen | CoreInputDeviceTypes.Mouse;
}
}