WPF Slider reverse direction

Hopefully pretty simple...

Page 1 of 1

3 Replies - 6933 Views - Last Post: 17 August 2009 - 07:16 AM Rate Topic: -----

#1 ragingben   User is offline

  • D.I.C Addict
  • member icon

Reputation: 177
  • View blog
  • Posts: 646
  • Joined: 07-October 08

WPF Slider reverse direction

Post icon  Posted 17 August 2009 - 01:27 AM

Hi all, having a bit of trouble with the WPF slider. You see, I want to be able to have it so that the slider is placed vertically with the minimum value nearest the top of the screen rather than at the bottom.

I've tried the old trick of putting the max value to the minium property, and the minimum value to the max property but it looks like WPF wont let you do that.

Heres my code I'm using for a right to left slider

<Slider Maximum="10" Minimum="0" Value="7" FlowDirection="RightToLeft" TickFrequency="1" TickPlacement="BottomRight"/>



Not that that is much help!

Is This A Good Question/Topic? 0
  • +

Replies To: WPF Slider reverse direction

#2 SwiftStriker00   User is offline

  • No idea why my code works
  • member icon

Reputation: 439
  • View blog
  • Posts: 1,617
  • Joined: 25-December 08

Re: WPF Slider reverse direction

Posted 17 August 2009 - 05:16 AM

View Postragingben, on 17 Aug, 2009 - 02:27 AM, said:

Hi all, having a bit of trouble with the WPF slider. You see, I want to be able to have it so that the slider is placed vertically with the minimum value nearest the top of the screen rather than at the bottom.

I've tried the old trick of putting the max value to the minium property, and the minimum value to the max property but it looks like WPF wont let you do that.

Heres my code I'm using for a right to left slider

<Slider Maximum="10" Minimum="0" Value="7" FlowDirection="RightToLeft" TickFrequency="1" TickPlacement="BottomRight"/>



Not that that is much help!


I'm not good with WPF, but we do have a WPF Forum, now. You might want to move your post there, because the gurus might be hanging out there
Was This Post Helpful? 0
  • +
  • -

#3 Core   User is offline

  • using System.Linq;
  • member icon

Reputation: 784
  • View blog
  • Posts: 5,101
  • Joined: 08-December 08

Re: WPF Slider reverse direction

Posted 17 August 2009 - 06:10 AM

It is quite an easy trick and all you have to do is set the Orientation property to Vertical and the IsDirectionreversed property to True. Like this:

		<Slider Name="Slider1" Maximum="10" Minimum="0" Value="7" IsDirectionreversed="True" Orientation="Vertical"  TickFrequency="1" TickPlacement="BottomRight" ValueChanged="Slider_ValueChanged" />



Just an advice, when you create controls in XAML, don't forget to set the Name property. This will help you avoid problems later.
Was This Post Helpful? 1
  • +
  • -

#4 ragingben   User is offline

  • D.I.C Addict
  • member icon

Reputation: 177
  • View blog
  • Posts: 646
  • Joined: 07-October 08

Re: WPF Slider reverse direction

Posted 17 August 2009 - 07:16 AM

Thanks Core, don't worry I always set that, just not in that example :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1