如何使用触摸控制用户surfaceslider(How to user surfaceslider

2019-10-16 13:16发布

我想用我的surfaceslider控制内部tagvisualization,使其响应当一个对象被放置到手指触摸,但是当我运行程序它不移动的。 任何人都可以给我指针(我是新来这个SDK)。


<s:TagVisualization x:Class="ControlsBox.TagVisual"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="http://schemas.microsoft.com/surface/2008"
Loaded="TagVisual_Loaded">
<Grid>
    <!--ProgressBar Margin="50" HorizontalAlignment="Center" Value=""-->
    <TextBlock Height="23" HorizontalAlignment="Center" Margin="0" Name="textBlock1" Text="" VerticalAlignment="Top" Padding="0,6,0,0" Foreground="#FFAA4A4A" />
    <s:SurfaceSlider Width="100" Height="20" HorizontalAlignment="Center" VerticalAlignment="Top" Padding="0,50,0,0" Value="60" IsSelectionRangeEnabled="False" Margin="20" Name="mySlider" Maximum="100" Interval="1" ValueChanged="mySlider_ValueChanged">
        <s:SurfaceSlider.Effect>
            <BlurEffect Radius="2"/>
        </s:SurfaceSlider.Effect>
    </s:SurfaceSlider>
    <Ellipse Width="200" Height="200" Stroke="White" StrokeThickness="8" Opacity="0.7">
        <Ellipse.Effect>
            <BlurEffect Radius="12" />
        </Ellipse.Effect>
    </Ellipse>
    <Ellipse Height="196" Width="196" Stroke="AntiqueWhite" StrokeThickness="4" >
        <Ellipse.Effect>
            <BlurEffect Radius="4"/>
        </Ellipse.Effect>   
    </Ellipse>
    <Label Content="John's Phone" HorizontalContentAlignment="Center" Padding="0,150,0,0" VerticalContentAlignment="Bottom">
        <Label.Effect>
            <DropShadowEffect BlurRadius="9" ShadowDepth="0" Color="Aqua"/>
        </Label.Effect>
    </Label>

</Grid>


    private void mySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
    {
        this.textBlock1.Text = Math.Round(this.mySlider.Value/100,2).ToString();
    }

Answer 1:

该标签覆盖它,以便在触摸不会得到它。 设置IsHitTestVisible =标签和其他任何你不想接收触摸输入的错误。 鼠标输入的工作方式相同。 像“史努比”的工具是非常适合这样的调试问题



文章来源: How to user surfaceslider with touch control
标签: pixelsense