Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

スライダーの追加 #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions MetroRadiance/MetroRadiance.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
<Generator>MSBuild:Compile</Generator>
<DependentUpon>Controls.xaml</DependentUpon>
</Page>
<Page Include="Styles\Controls.Slider.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<DependentUpon>Controls.xaml</DependentUpon>
</Page>
<Page Include="Styles\Controls.ToggleButton.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
384 changes: 384 additions & 0 deletions MetroRadiance/Styles/Controls.Slider.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,384 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System="clr-namespace:System;assembly=mscorlib">

<System:Double x:Key="HorizontalThumbWidth">10</System:Double>
<System:Double x:Key="HorizontalThumbHeight">18</System:Double>
<System:Double x:Key="VerticalThumbWidth">18</System:Double>
<System:Double x:Key="VerticalThumbHeight">10</System:Double>

<Style x:Key="ActiveSliderDecreaseRepeatButtonStyle"
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}">
<Rectangle x:Name="Background"
Fill="{DynamicResource AccentHighlightBrushKey}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SemiactiveSliderDecreaseRepeatButtonStyle"
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}">
<Rectangle x:Name="Background"
Fill="{DynamicResource AccentBrushKey}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="ActiveSliderIncreaseRepeatButtonStyle"
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}">
<Rectangle x:Name="Background"
Fill="{DynamicResource ActiveBackgroundBrushKey}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SemiactiveSliderIncreaseRepeatButtonStyle"
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}">
<Rectangle x:Name="Background"
Fill="Transparent"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver"
Value="true">
<Setter Property="Fill"
TargetName="Background"
Value="{DynamicResource ForegroundBrushKey}"/>
</Trigger>
<Trigger Property="IsKeyboardFocused"
Value="true">
<Setter Property="Fill"
TargetName="Background"
Value="{DynamicResource ForegroundBrushKey}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="ActiveHorizontalSliderThumbStyle"
TargetType="{x:Type Thumb}">
<Setter Property="Focusable"
Value="false"/>
<Setter Property="OverridesDefaultStyle"
Value="true"/>
<Setter Property="Height"
Value="{DynamicResource HorizontalThumbHeight}"/>
<Setter Property="Width"
Value="{DynamicResource HorizontalThumbWidth}"/>
<Setter Property="Foreground"
Value="{DynamicResource ActiveForegroundBrushKey}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Grid x:Name="Background"
Background="{DynamicResource ActiveForegroundBrushKey}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SemiactiveHorizontalSliderThumbStyle"
TargetType="{x:Type Thumb}">
<Setter Property="Focusable"
Value="false"/>
<Setter Property="OverridesDefaultStyle"
Value="true"/>
<Setter Property="Height"
Value="{DynamicResource HorizontalThumbHeight}"/>
<Setter Property="Width"
Value="{DynamicResource HorizontalThumbWidth}"/>
<Setter Property="Foreground"
Value="{DynamicResource SemiActiveForegroundBrushKey}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Grid x:Name="Background"
Background="{DynamicResource SemiActiveForegroundBrushKey}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="ActiveVerticalSliderThumbStyle"
TargetType="{x:Type Thumb}">
<Setter Property="Focusable"
Value="false"/>
<Setter Property="OverridesDefaultStyle"
Value="true"/>
<Setter Property="Height"
Value="11"/>
<Setter Property="Width"
Value="16"/>
<Setter Property="Foreground"
Value="{DynamicResource ActiveForegroundBrushKey}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Grid x:Name="Background"
Background="{DynamicResource ActiveForegroundBrushKey}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SemiactiveVerticalSliderThumbStyle"
TargetType="{x:Type Thumb}">
<Setter Property="Focusable"
Value="false"/>
<Setter Property="OverridesDefaultStyle"
Value="true"/>
<Setter Property="Height"
Value="11"/>
<Setter Property="Width"
Value="16"/>
<Setter Property="Foreground"
Value="{DynamicResource SemiActiveForegroundBrushKey}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Grid x:Name="Background"
Background="{DynamicResource SemiActiveForegroundBrushKey}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="{x:Type Slider}">
<Setter Property="Stylus.IsPressAndHoldEnabled"
Value="false"/>
<Setter Property="Background"
Value="Transparent"/>
<Setter Property="Foreground"
Value="{DynamicResource InactiveForegroundBrushKey}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Slider}">
<Border BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
SnapsToDevicePixels="true">
<Grid>
<Grid x:Name="TrackBackground"
Background="{DynamicResource SemiactiveBackgroundBrushKey}"
Height="16"
Grid.Row="1"
VerticalAlignment="center" />
<Track x:Name="PART_Track">
<Track.DecreaseRepeatButton>
<RepeatButton x:Name="DecreaseRepeatButton"
Command="{x:Static Slider.DecreaseLarge}"
Style="{StaticResource SemiactiveSliderDecreaseRepeatButtonStyle}">
</RepeatButton>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton x:Name="IncreaseRepeatButton"
Command="{x:Static Slider.IncreaseLarge}"
Style="{StaticResource SemiactiveSliderIncreaseRepeatButtonStyle}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb"
Style="{StaticResource SemiactiveHorizontalSliderThumbStyle}"/>
</Track.Thumb>
</Track>
</Grid>
</Border>
<ControlTemplate.Triggers>
<!--<Trigger Property="TickPlacement"
Value="TopLeft">
<Setter Property="Style"
TargetName="Thumb"
Value="{StaticResource HorizontalSliderUpThumbStyle}"/>
</Trigger>
<Trigger Property="TickPlacement"
Value="BottomRight">
<Setter Property="Style"
TargetName="Thumb"
Value="{StaticResource HorizontalSliderDownThumbStyle}"/>
</Trigger>
<Trigger Property="TickPlacement"
Value="Both">
<Setter Property="Visibility"
TargetName="TopTick"
Value="Visible"/>
<Setter Property="Visibility"
TargetName="BottomTick"
Value="Visible"/>
</Trigger-->
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background"
TargetName="TrackBackground"
Value="{DynamicResource ActiveBackgroundBrushKey}" />
<Setter Property="Style"
TargetName="DecreaseRepeatButton"
Value="{DynamicResource ActiveSliderDecreaseRepeatButtonStyle}" />
<Setter Property="Style"
TargetName="IncreaseRepeatButton"
Value="{DynamicResource ActiveSliderIncreaseRepeatButtonStyle}" />
<Setter Property="Style"
TargetName="Thumb"
Value="{DynamicResource ActiveHorizontalSliderThumbStyle}" />
</Trigger>
<Trigger Property="IsKeyboardFocused"
Value="true">
<Setter Property="Background"
TargetName="TrackBackground"
Value="{DynamicResource ActiveBackgroundBrushKey}" />
<Setter Property="Style"
TargetName="DecreaseRepeatButton"
Value="{DynamicResource ActiveSliderDecreaseRepeatButtonStyle}" />
<Setter Property="Style"
TargetName="IncreaseRepeatButton"
Value="{DynamicResource ActiveSliderIncreaseRepeatButtonStyle}" />
<Setter Property="Style"
TargetName="Thumb"
Value="{DynamicResource ActiveHorizontalSliderThumbStyle}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="Orientation"
Value="Vertical">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Slider}">
<Border x:Name="TrackBackground"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
SnapsToDevicePixels="true">
<Grid>
<Canvas Margin="-1,-6">
<Rectangle x:Name="PART_SelectionRange"
Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"
Stroke="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"
StrokeThickness="1.0"
Visibility="Hidden"
Width="4.0"/>
</Canvas>
<Track x:Name="PART_Track"
Grid.Column="1">
<Track.DecreaseRepeatButton>
<RepeatButton x:Name="DecreaseRepeatButton"
Command="{x:Static Slider.DecreaseLarge}"
Style="{StaticResource SemiactiveSliderDecreaseRepeatButtonStyle}"/>
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton x:Name="IncreaseRepeatButton"
Command="{x:Static Slider.IncreaseLarge}"
Style="{StaticResource SemiactiveSliderDecreaseRepeatButtonStyle}"/>
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb x:Name="Thumb"
Style="{StaticResource SemiactiveVerticalSliderThumbStyle}"/>
</Track.Thumb>
</Track>
</Grid>
</Border>
<ControlTemplate.Triggers>
<!--<Trigger Property="TickPlacement"
Value="TopLeft">
<Setter Property="Visibility"
TargetName="TopTick"
Value="Visible"/>
<Setter Property="Style"
TargetName="Thumb"
Value="{StaticResource VerticalSliderLeftThumbStyle}"/>
</Trigger>
<Trigger Property="TickPlacement"
Value="BottomRight">
<Setter Property="Visibility"
TargetName="BottomTick"
Value="Visible"/>
<Setter Property="Style"
TargetName="Thumb"
Value="{StaticResource VerticalSliderRightThumbStyle}"/>
</Trigger>
<Trigger Property="TickPlacement"
Value="Both">
<Setter Property="Visibility"
TargetName="TopTick"
Value="Visible"/>
<Setter Property="Visibility"
TargetName="BottomTick"
Value="Visible"/>
</Trigger>-->
<Trigger Property="IsSelectionRangeEnabled"
Value="true">
<Setter Property="Visibility"
TargetName="PART_SelectionRange"
Value="Visible"/>
</Trigger>
<Trigger Property="IsMouseOver"
Value="true">
<Setter Property="Background"
TargetName="TrackBackground"
Value="{DynamicResource ActiveBackgroundBrushKey}" />
<Setter Property="Style"
TargetName="DecreaseRepeatButton"
Value="{DynamicResource ActiveSliderDecreaseRepeatButtonStyle}" />
<Setter Property="Style"
TargetName="IncreaseRepeatButton"
Value="{DynamicResource ActiveSliderIncreaseRepeatButtonStyle}" />
<Setter Property="Style"
TargetName="Thumb"
Value="{DynamicResource ActiveHorizontalSliderThumbStyle}" />
</Trigger>
<Trigger Property="IsKeyboardFocused"
Value="true">
<Setter Property="Background"
TargetName="TrackBackground"
Value="{DynamicResource ActiveBackgroundBrushKey}" />
<Setter Property="Style"
TargetName="DecreaseRepeatButton"
Value="{DynamicResource ActiveSliderDecreaseRepeatButtonStyle}" />
<Setter Property="Style"
TargetName="IncreaseRepeatButton"
Value="{DynamicResource ActiveSliderIncreaseRepeatButtonStyle}" />
<Setter Property="Style"
TargetName="Thumb"
Value="{DynamicResource ActiveHorizontalSliderThumbStyle}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
Loading