none
Customizing TickBar control

    Question

  • Does anyone have an idea on how to customize a Tickbar control ticks, maybe using data templates.
    In fact what I need is to control the way each and every single tick in drawn. like you can customize Listbox items using data temlates.

    Thanks, Udi

    Tuesday, August 12, 2008 7:56 AM

Answers

  • Fair enough. Unfortunately, there's no way to do this. The Tickbar uses the low-level OnRender mechanism for presenting its visuals. This means that the way in which it generates the ticks is very much hard-coded in, and there's no extensibility mechanism to let you change the ticks.

    Sorry not to have a more positive answer, but that's how the Tickbar seems to be written, sadly. I'm guessing it's an efficiency thing - the advantage with this hard-coded approach they've used is that it makes the Tickbar's footprint in the visual tree an order of magnitude smaller than it would be if it supported templateable ticks. And since the visual tree element count is often the main factor in application performance, that's probably why it works the way it does.
    Tuesday, August 12, 2008 11:37 AM

All replies

  • Given that the only thing that Tickbar does is draw ticks, and you want to customize every single tick, why would you even use Tickbar at all? If you want to replace its ticks with ticks you've drawn yourself, what is left for the Tickbar to do?
    Tuesday, August 12, 2008 10:55 AM
  • The tick bar has a frequency, minimum, maximum... properties among others that I'd like to preserve.
    Besides that I dont want to draw each tick seperatly. If I had the option to set a data template I coulde spacify a way of drawing one end the Tickbar would take care of the rest (drawing all the ticks).
    Consider a requierment to change the way the ticks looks, that what I need. (among other things) 

    Thanks for your replay.
    Tuesday, August 12, 2008 11:33 AM
  • Fair enough. Unfortunately, there's no way to do this. The Tickbar uses the low-level OnRender mechanism for presenting its visuals. This means that the way in which it generates the ticks is very much hard-coded in, and there's no extensibility mechanism to let you change the ticks.

    Sorry not to have a more positive answer, but that's how the Tickbar seems to be written, sadly. I'm guessing it's an efficiency thing - the advantage with this hard-coded approach they've used is that it makes the Tickbar's footprint in the visual tree an order of magnitude smaller than it would be if it supported templateable ticks. And since the visual tree element count is often the main factor in application performance, that's probably why it works the way it does.
    Tuesday, August 12, 2008 11:37 AM
  • So its a dead end ah !?
    Thanks anyway I'll try to find another path, maybe draw them using code behind.
    Tuesday, August 12, 2008 12:54 PM