UWP - 使用IsHitTestVisible = false堆叠的多个InkCanvases仍然捕获墨迹

时间:2016-04-11 02:26:28

标签: c# win-universal-app hittest inkcanvas

我有两个ishittestvisible=false堆叠,我想让顶部通过墨水到底部。我将顶部设置为false,但仍然会收到墨迹。然后作为测试我将两者都设置为<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.xaml中

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;
    }
}

MainPage.cs

    public function up()
{
    Schema::create('t_calendarios', function (Blueprint $table) {
        $table->primary()->date('fecLab');
    });
}

0 个答案:

没有答案