Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 适用于windows phone 7的Silder_C#_Windows Phone 7 - Fatal编程技术网

C# 适用于windows phone 7的Silder

C# 适用于windows phone 7的Silder,c#,windows-phone-7,C#,Windows Phone 7,在使用WindowsPhone7应用程序的滑块时,我面临一个问题,即如何使滑块位于中间位置。我正在尝试的是得到一个平衡滑块,其中一个可以滑动到左边或右边的位置和中心将是默认的 <Style x:Key="SliderStyle1" TargetType="Slider"> <Setter Property="BorderThickness" Value="0"/> <Setter Property="BorderBrush" Valu

在使用WindowsPhone7应用程序的滑块时,我面临一个问题,即如何使滑块位于中间位置。我正在尝试的是得到一个平衡滑块,其中一个可以滑动到左边或右边的位置和中心将是默认的

<Style x:Key="SliderStyle1" TargetType="Slider">
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="Maximum" Value="10"/>
        <Setter Property="Minimum" Value="0"/>
        <Setter Property="Value" Value="0"/>
        <Setter Property="Background" Value="{StaticResource PhoneContrastBackgroundBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Slider">
                    <Grid Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0" To="0.1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HorizontalTrack"/>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="HorizontalFill">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid x:Name="HorizontalTemplate" Margin="0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="0"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Rectangle x:Name="HorizontalTrack" Fill="{TemplateBinding Background}" Height="12" IsHitTestVisible="False" Margin="0,22,0,50" Opacity="0.2" Grid.Column="2" RadiusY="6" RadiusX="6" StrokeThickness="2" />
                            <Rectangle x:Name="HorizontalFill" Fill="{TemplateBinding Foreground}" Height="12" IsHitTestVisible="False" Margin="0,22,0,50" RadiusX="6" RadiusY="6" RenderTransformOrigin="0,0"/>
                            <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton" Grid.Column="0" IsTabStop="False" Template="{StaticResource PhoneSimpleRepeatButton}"/>
                            <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton" Grid.Column="1" IsTabStop="True" Template="{StaticResource PhoneSimpleRepeatButton}" HorizontalAlignment="Right"/>
                            <Thumb x:Name="HorizontalThumb" Grid.Column="1" Margin="-1,0,0,30" RenderTransformOrigin="0.5,0.5" Template="{StaticResource PhoneSimpleThumb}" Width="1" BorderThickness="3" Background="Black" BorderBrush="#26000000" >
                                <Thumb.Foreground>
                                    <SolidColorBrush Color="#FF1BA1E2"/>
                                </Thumb.Foreground>
                                <Thumb.RenderTransform>
                                    <ScaleTransform ScaleY="1" ScaleX="32"/>
                                </Thumb.RenderTransform>
                            </Thumb>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

我想给它一个最小值和最大值,考虑最小值为负值,而不是零

**

我如何才能得到一个平衡滑块,其中一个可以滑动到左或右的位置和中心将是默认的,为他们提供了水平填充两侧


**控件模板似乎不是解决方案


在这种情况下使用滑块时,尝试只设置
Maximum=“1”Minimum=“-1”Value=“0”
控件模板似乎不是解决方案

在这种情况下使用滑块时,请尝试设置
Maximum=“1”Minimum=“-1”Value=“0”