0

したがって、基本的には、指、タグ、ブロブのタッチを認識するトレーニング画面を除いて、すべての画面から指とタグのタッチのみを認識するようにタッチ入力をフィルタリングします。これを行うには、SurfaceWindow である MainWindow の OnPreviewTouchDown(TouchEventArgs e) メソッドをオーバーライドします。オーバーライド メソッドについては、以下のコードを参照してください。

    protected override void OnPreviewTouchDown(TouchEventArgs e)
    {

        bool isFinger = e.TouchDevice.GetIsFingerRecognized();
        bool isTag = e.TouchDevice.GetIsTagRecognized();
        //Allows all touches on Train Screen. Only fingers and tags everywhere else
        if (e.Source.ToString() != "dtt_app.TrainScreen")
        {
            if (isFinger == false && isTag == false)
            {
                e.Handled = true;
                return;
            }
        }
       base.OnPreviewTouchDown(e);
    }

これは私のトークン視覚化コードがどのように見えるかです

        for (int i = 1; i < 10; i++)
        {
            TagVisualizationDefinition TokenTagDef =
                    new TagVisualizationDefinition();
            // The tag value that this definition will respond to.
            TokenTagDef.Value = i;
            // The .xaml file for the UI
            TokenTagDef.Source =
                new Uri("TokenVisualization.xaml", UriKind.Relative);
            // The maximum number for this tag value.
            TokenTagDef.MaxCount = 100;
            // Orientation offset (default).
            TokenTagDef.OrientationOffsetFromTag = 0.0;
            // Physical offset (horizontal inches, vertical inches).
            TokenTagDef.PhysicalCenterOffsetFromTag = new Vector(0.0, 0.0);
            // Tag removal behavior (default).
            TokenTagDef.TagRemovedBehavior = TagRemovedBehavior.Fade;
            // Orient UI to tag? (default).
            TokenTagDef.UsesTagOrientation = true;

            // Add the definition to the collection.
            MyTagVisualizer.Definitions.Add(TokenTagDef);

        }

これは、MainWindow のコンテンツとして設定された UserControl である TrainScreen の XAML コードです。

<UserControl x:Class="dtt_app.TrainScreen"
             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:s="http://schemas.microsoft.com/surface/2008"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <s:TagVisualizer
            Name="MyTagVisualizer" 
            VerticalAlignment="Stretch"
            HorizontalAlignment="Stretch"
            Background="Transparent" 
            Height="Auto" Width="Auto"
            VisualizationAdded="OnVisualizationAdded">

        <Canvas Name="canvas" Width="{Binding ElementName=topWindow, Path=ActualWidth}" Height="{Binding ElementName=topWindow, Path=ActualHeight}">
        <Label Width ="500" Canvas.Top="100" Content="Label" Name="Instruction" FontSize="30" HorizontalContentAlignment="Center"/>
        <Popup Name="Positive" Width="240" Height="200" Placement="MousePoint" AllowsTransparency="True" IsEnabled="True" IsOpen="False">
            <Image Source="images/SmileyFace.png">
            </Image>
        </Popup>
        <Popup Name="Negative" Width="240" Height="200" Placement="MousePoint" IsEnabled="True" AllowsTransparency="True" IsOpen="False">
            <Image Source="images/SadFace.png">
            </Image>
        </Popup>
    </Canvas>
    </s:TagVisualizer>
    </Grid>
</UserControl>

タグ付けされたオブジェクトがテーブル上にあるときにタッチ入力が認識されない理由がわかりません。これについての助けをいただければ幸いです。お願いします。私はあらゆる可能性を使い果たしました。時間がなくなったので、これを解決する必要があります。前もって感謝します。

4

1 に答える 1

0

おそらく問題は、入力が tagvisualization へのヒット テストであるということです (そのためのコードを見せてくれませんでした)。「透明」ヒット テストされていることに注意してください (ヒット テストを行わないようにするには、Background=null または IsHitTestVisible=false を使用します)。

入力ビジュアライザー ツールを実行することで、ハードウェア/プラットフォームの問題ではないことを確認できます。

于 2013-09-19T16:51:05.377 に答える