Newer
Older
Correlator / PipeGallery / Style / Slider.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:PipeGallery.Style">
    
    <SolidColorBrush x:Key="HorizontalSliderTrackNormalBackground" Color="#FFE7EAEA"/>
    <Style x:Key="SliderRepeatButtonStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Grid>
                        <Canvas ClipToBounds="True" >
                            <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="0" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="6" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="12" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="18" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="24" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="30" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="36" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="42" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="48" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="54" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="60" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="66" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="72" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="78" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="84" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="90" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="96" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="102" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="108" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="114" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="120" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="126" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="132" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="138" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="144" VerticalAlignment="Bottom" Background="#258ACA"/>
                            <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="148" VerticalAlignment="Bottom" Background="#258ACA"/>
                        </Canvas>
                        <Border Width="1" Background="#258ACA"/>
                        
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="SliderRepeatButtonStyle1" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Grid>
                        
                        <Border Width="1" Background="#b1b1b1"/>
                        
                    </Grid>
                    
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="HorizontalSliderThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Height" Value="6"/>
        <Setter Property="Width" Value="30"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Background="#258ACA" Width="16" Height="6">
                        <Canvas x:Name="canvas">
                            <Border Canvas.Left="25" Canvas.Top="-12" Width="36" Height="32" >
                                <Border.Background>
                                    <ImageBrush ImageSource="/PipeGallery;component/Image/ty_tips.png"/>
                                </Border.Background>
                                <TextBlock Foreground="White" Text="{Binding Path=Value}" Margin="2,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </Border>
                        </Canvas>
                    </Border>
                    <ControlTemplate.Triggers>
                        <!--<Trigger Property="IsDragging" Value="true">
                            <Setter TargetName="canvas" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="IsDragging" Value="false">
                            <Setter TargetName="canvas" Property="Visibility" Value="Collapsed"/>
                        </Trigger>-->
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SliderStyle" TargetType="{x:Type Slider}">
        <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="#FFC4C4C4"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Slider}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto" MinWidth="{TemplateBinding MinHeight}"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Canvas ClipToBounds="True" Height="150" Grid.ColumnSpan="3">
                                <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="0" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="6" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="12" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="18" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="24" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="30" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="36" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="42" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="4" Height="1"  Canvas.Left="16" Canvas.Bottom="48" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="54" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="60" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="66" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="72" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="78" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="84" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="90" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="96" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="102" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="108" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="114" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="120" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="126" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="132" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="138" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="4" Height="1" Canvas.Left="16" Canvas.Bottom="144" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                                <Border Width="2" Height="1" Canvas.Left="16" Canvas.Bottom="150" VerticalAlignment="Bottom" Background="#b1b1b1"/>
                            </Canvas>
                            <TickBar x:Name="TopTick" Fill="{TemplateBinding Foreground}" Placement="Top" Grid.Column="0" Visibility="Collapsed"/>
                            <TickBar x:Name="BottomTick" Fill="{TemplateBinding Foreground}" Placement="Bottom" Grid.Column="2" Visibility="Collapsed"/>
                            <Border x:Name="TrackBackground" BorderBrush="Transparent" BorderThickness="0.5" Background="Transparent" CornerRadius="1" Margin="5,0" Grid.Column="1" VerticalAlignment="center">
                                <Canvas Margin="-6,-1" >
                                    <Rectangle x:Name="PART_SelectionRange" Stroke="red" StrokeThickness="0.5" Visibility="Hidden"/>
                                </Canvas>
                            </Border>
                            <Track x:Name="PART_Track" Grid.Column="1">
                                
                                <Track.IncreaseRepeatButton>
                                    <RepeatButton Command="{x:Static Slider.IncreaseLarge}" Style="{StaticResource SliderRepeatButtonStyle1}"/>
                                </Track.IncreaseRepeatButton>
                                <Track.DecreaseRepeatButton>
                                    <RepeatButton Command="{x:Static Slider.DecreaseLarge}" Style="{StaticResource SliderRepeatButtonStyle}"/>
                                </Track.DecreaseRepeatButton>
                                <Track.Thumb>
                                    <Thumb x:Name="Thumb" Style="{StaticResource HorizontalSliderThumbStyle}"/>
                                </Track.Thumb>
                            </Track>

                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>