PageRenderTime 24ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

/Application/GUI/Controls/EnhancedSlider.xaml

http://yet-another-music-application.googlecode.com/
XAML | 113 lines | 102 code | 9 blank | 2 comment | 0 complexity | cb0ce5dbef10177d18cb1da10c93f9da MD5 | raw file
  1<Slider x:Class="Stoffi.EnhancedSlider"
  2		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5		xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6		xmlns:local="clr-namespace:Stoffi"
  7		mc:Ignorable="d"
  8		d:DesignWidth="800"
  9		d:DesignHeight="30"
 10		Value="1">
 11	<Slider.Resources>
 12		<LinearGradientBrush x:Key="AeroSeekBackground" EndPoint="0,1" StartPoint="0,0">
 13			<GradientStop Color="#55888888" Offset="0.1"/>
 14			<GradientStop Color="#55FFFFFF" Offset="0.9"/>
 15		</LinearGradientBrush>
 16		<LinearGradientBrush x:Key="AeroSeekBorder" EndPoint="0,1" StartPoint="0,0">
 17			<GradientStop Color="#FFAEB1AF" Offset="0.1"/>
 18			<GradientStop Color="White" Offset="0.9"/>
 19		</LinearGradientBrush>
 20		<LinearGradientBrush x:Key="AeroSeekSecondValueFill" EndPoint="0,1" StartPoint="0,0">
 21			<GradientStop Color="#88555555" Offset="0.1"/>
 22			<GradientStop Color="#88CCCCCC" Offset="0.9"/>
 23		</LinearGradientBrush>
 24		<Style x:Key="AeroSeekValueFill" TargetType="{x:Type RepeatButton}">
 25			<Setter Property="OverridesDefaultStyle" Value="true"/>
 26			<Setter Property="IsTabStop" Value="false"/>
 27			<Setter Property="Focusable" Value="false"/>
 28			<Setter Property="Template">
 29				<Setter.Value>
 30					<ControlTemplate TargetType="{x:Type RepeatButton}">
 31						<Border BorderThickness="1" CornerRadius="3,0,0,3">
 32							<Border.Background>
 33								<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
 34									<GradientStop Color="#FF333333" Offset="0.1"/>
 35									<GradientStop Color="#FFCCCCCC" Offset="0.9"/>
 36								</LinearGradientBrush>
 37							</Border.Background>
 38						</Border>
 39					</ControlTemplate>
 40				</Setter.Value>
 41			</Setter>
 42		</Style>
 43		<Style x:Key="AeroSeekRightFill" TargetType="{x:Type RepeatButton}">
 44			<Setter Property="OverridesDefaultStyle" Value="true"/>
 45			<Setter Property="IsTabStop" Value="false"/>
 46			<Setter Property="Focusable" Value="false"/>
 47			<Setter Property="Template">
 48				<Setter.Value>
 49					<ControlTemplate TargetType="{x:Type RepeatButton}">
 50						<Rectangle Fill="Transparent"/>
 51					</ControlTemplate>
 52				</Setter.Value>
 53			</Setter>
 54		</Style>
 55
 56		<!-- Aero styles -->
 57		<Style x:Key="AeroSeekStyle" TargetType="{x:Type Slider}">
 58
 59		</Style>
 60
 61		<Style x:Key="AeroVolumeStyle" TargetType="{x:Type Slider}">
 62		</Style>
 63
 64		<!-- Classic styles -->
 65
 66		<Style x:Key="ClassicSeekStyle" TargetType="{x:Type Slider}">
 67
 68		</Style>
 69
 70		<Style x:Key="ClassicVolumeStyle" TargetType="{x:Type Slider}">
 71
 72		</Style>
 73
 74	</Slider.Resources>
 75	<Slider.Style>
 76		<Style TargetType="{x:Type Slider}">
 77			<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
 78			<Setter Property="Background" Value="Transparent"/>
 79			<Setter Property="Foreground" Value="#FFC4C4C4"/>
 80			<Setter Property="Template">
 81				<Setter.Value>
 82					<ControlTemplate TargetType="{x:Type Slider}">
 83						<Border SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
 84							<Grid>
 85								<Grid.RowDefinitions>
 86									<RowDefinition Height="*"/>
 87								</Grid.RowDefinitions>
 88								<Border x:Name="TrackBackground" Grid.Row="1" Background="{DynamicResource AeroSeekBackground}" BorderBrush="{DynamicResource AeroSeekBorder}" BorderThickness="1" CornerRadius="3">
 89									<Border x:Name="SecondValueIndicator" 
 90											Background="{DynamicResource AeroSeekSecondValueFill}" 
 91											Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SecondValueWidth, Mode=TwoWay}" 
 92											HorizontalAlignment="Left">
 93									</Border>
 94								</Border>
 95								<Track x:Name="PART_Track" Grid.Row="1">
 96									<Track.DecreaseRepeatButton>
 97										<RepeatButton Style="{DynamicResource AeroSeekValueFill}" Command="{x:Static Slider.DecreaseLarge}"/>
 98									</Track.DecreaseRepeatButton>
 99									<Track.IncreaseRepeatButton>
100										<RepeatButton Style="{DynamicResource AeroSeekRightFill}" Command="{x:Static Slider.IncreaseLarge}"/>
101									</Track.IncreaseRepeatButton>
102									<Track.Thumb>
103										<Thumb x:Name="Thumb" Width="0"/>
104									</Track.Thumb>
105								</Track>
106							</Grid>
107						</Border>
108					</ControlTemplate>
109				</Setter.Value>
110			</Setter>
111		</Style>
112	</Slider.Style>
113</Slider>