1 Replies - 5953 Views - Last Post: 20 October 2013 - 11:15 PM Rate Topic: -----

#1 SPACEMTNMAN  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 44
  • Joined: 25-June 09

[Help] - Custom slider thumb + slider simulating mouse

Posted 20 October 2013 - 09:25 PM

Hi, Ive been coding vb.net for a while and ive started venturing in to WPF and its so incredibly frustrating because it seems like you have to type a wall of text just to get anything done. Im trying to create a slider that has a custom graphic as its thumb. Can anybody talk me through this step by step. from what ive gathered i need to set a slider style but everywhere ive looked it gives the style code but no way of implementing it.
can anybody help?
Cheers
Jack

Is This A Good Question/Topic? 0
  • +

Replies To: [Help] - Custom slider thumb + slider simulating mouse

#2 MrShoes  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 331
  • View blog
  • Posts: 512
  • Joined: 13-June 12

Re: [Help] - Custom slider thumb + slider simulating mouse

Posted 20 October 2013 - 11:15 PM

Normally I'd make a joke about a VB developer being averse to verbose code, but since in this case you actually do need to write a lot of code to achieve what you're doing, I won;t throw stones from my glass house.

Anyway, yes, it's a pretty complex thing that you want to do, because you want to restyle a defined control. It's not as easy as simply setting a Border's corner radius, for example. But you do highlight the fact that some things are simply hard to do in WPF, and maybe Microsoft need a better API for their controls.

I assume you've read the MSDN document about how to do this. In a nutshell, what you need to do is this:

  • Create a Style with a target type of Thumb.
  • Give that Style a ControlTemplate that also has a target type of Thumb.
  • In that control template, draw the image (probably using a Canvas with your image).
  • Create a ControlTemplate for your slider.
  • In the Track definition, reference the Style you created for the Track.Thumb property.


This is assuming you know how to bind items to controls and to apply styles.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1