![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Slider Control Styling Does any body have a control template / style overridden for Slider control? My intension is to draw a small rectangle from the left side to the Thumb point while user changes Slider value. The background will be another rectangular area, When I use my Arrow keys I am getting the ValueChange Event from the following code. I wanted to have the mouse click ability also on the slider. <Style TargetType="{x:Type Slider}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Slider}"> <Canvas Name="Canvas" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" MinWidth="{TemplateBinding MinWidth}" MinHeight="{TemplateBinding MinHeight}" MaxHeight="{TemplateBinding MaxHeight}"> </Canvas> <ControlTemplate.Triggers> <Trigger Property="Slider.IsMouseOver" Value="True"> <Setter Property = "Background" Value="Green"/> <Setter Property = "TickPlacement" Value ="TopLeft"/> <Setter Property = "IsMoveToPointEnabled" Value ="True"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Slider Control Styling Hi guys, I just finished the styling of slider as I wanted using the information from MSDN at http://windowssdk.msdn.microsoft.com...56(VS.80).aspx Here is my slider code. <Window.Resources> <ControlTemplate x:Key="HorizontalSlider" TargetType="{x:Type Slider}"> <Canvas> <Canvas.Background> <LinearGradientBrush StartPoint="0,1" EndPoint="0,0"> <LinearGradientBrush.GradientStops> <GradientStop Color="Black" Offset="0.03"/> <GradientStop Color="AliceBlue" Offset="0.4"/> <GradientStop Color="DarkSlateGray" Offset="1"/> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Canvas.Background> <Track x:Name="PART_Track" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"> <Track.DecreaseRepeatButton> <RepeatButton Command="Slider.DecreaseLarge" Opacity="0.9"> <RepeatButton.BitmapEffect> <BevelBitmapEffect BevelWidth="2" EdgeProfile="CurvedIn" LightAngle="3" /> </RepeatButton.BitmapEffect> <RepeatButton.Background> <LinearGradientBrush StartPoint="1,1" EndPoint="0,0"> <LinearGradientBrush.GradientStops> <GradientStop Offset="0.1" Color="Black"/> <GradientStop Offset="0.7" Color="AliceBlue"/> <GradientStop Offset="1" Color="DarkSlateGray"/> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </RepeatButton.Background> </RepeatButton> </Track.DecreaseRepeatButton> <Track.Thumb> <Thumb x:Name="Thumb" Height="{TemplateBinding Height}" Width="0"/> </Track.Thumb> <Track.IncreaseRepeatButton> <RepeatButton Command="Slider.IncreaseLarge" Opacity="0"/> </Track.IncreaseRepeatButton> </Track> </Canvas> </ControlTemplate> </Window.Resources> <Slider Template="{StaticResource HorizontalSlider}" Value="3" Height="33" Width="300" Name="Slider" Minimum="0" Maximum="10" SmallChange="1" Background="Blue" ToolTipService.Placement="MousePoint" ToolTip="{Binding ElementName=Slider,Path=Value}" IsMoveToPointEnabled="True" VerticalAlignment="Top" Margin="16,27,21,0" Grid.ColumnSpan="1"/> On Oct 13, 2:39 pm, "Jobi Joy" <jobi....@gmail.com> wrote: > Does any body have a control template / style overridden for Slider > control? > My intension is to draw a small rectangle from the left side to the > Thumb point while user changes Slider value. The background will be > another rectangular area, > When I use my Arrow keys I am getting the ValueChange Event from the > following code. I wanted to have the mouse click ability also on the > slider. > > <Style TargetType="{x:Type Slider}"> > <Setter Property="Template"> > <Setter.Value> > <ControlTemplate TargetType="{x:Type Slider}"> > <Canvas Name="Canvas" Width="{TemplateBinding Width}" > Height="{TemplateBinding Height}" > Background="{TemplateBinding Background}" > MinWidth="{TemplateBinding MinWidth}" > MinHeight="{TemplateBinding MinHeight}" > MaxHeight="{TemplateBinding MaxHeight}"> > </Canvas> > <ControlTemplate.Triggers> > <Trigger Property="Slider.IsMouseOver" Value="True"> > <Setter Property = "Background" Value="Green"/> > <Setter Property = "TickPlacement" Value ="TopLeft"/> > <Setter Property = "IsMoveToPointEnabled" Value > ="True"/> > </Trigger> > </ControlTemplate.Triggers> > </ControlTemplate> > </Setter.Value> > </Setter> > </Style> |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Volume slider drops to Zero | doboy | Vista hardware & devices | 1 | 06-20-2007 06:09 PM |
| How to determine index of TabItem when styling Tab | =?Utf-8?B?TmVhbCBCb3JlbGxp?= | Avalon | 0 | 08-15-2006 07:32 PM |
| Binding a value display for a slider? | Doug Brown | Avalon | 0 | 07-18-2006 07:53 AM |
| Styling the scroll bar | Philippe Lavoie | Avalon | 1 | 05-10-2006 12:03 PM |
| Slider control use | Jason Dolinger | Avalon | 2 | 01-10-2006 03:54 PM |