How to user surfaceslider with touch control

我的梦境 提交于 2019-12-24 10:06:55

问题


I want to use my surfaceslider control inside tagvisualization so that it responds to finger touch when an object is placed, but when I run the program it doesnt moves at all. Can anybody give me pointers (I am new to this 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();
    }

回答1:


The label is covering it up so the touch doesn't get to it. Set IsHitTestVisible=false on the label and anything else you don't want to receive touch input. Mouse input works the same way. Tools like "Snoop" are great for debugging issues like this



来源:https://stackoverflow.com/questions/7013357/how-to-user-surfaceslider-with-touch-control

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!