Help W/ Ribbon + ZOOM slider

Ribbon for WPF Forum

Posted 14 years ago by SledgeHammer01
Version: 9.2.0514
Avatar
I'm using the Ribbon + ZOOM slider in the way illustrated in the Document Editor sample. How can we make it more WORD 2007 like?

1)I set the range to 10% to 500% as in WORD. 100% is way over on the left as it should be MATHEMATICALLY, but not LOGICALLY. WORD places 100% (or whatever "default" value) in the center as you would expect. How can we do this?

2) WORD also has a single tick for the default value (centered of course as per #1) and the grab handle snaps to it. I know we can add a bunch of ticks, but would prefer only the center tick and snap to it, but still be able to use the rest of the values.

3) How can we remove the focus rectangle around the slider when you click on it?

Thanks!

Comments (2)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
1) You'd probably need to do a value converter between the Slider's value and the value you are updating to convert it how you need.

2) To add a single tick, you'd probably had to render that yourself. Also to make it snap to the single tick, you'd likely have to inherit the control and process mouse handling on your own, or at least customize the mouse handling when it is near your tick. I believe Slider has some snapping functionality built-in but it is different from how Word snaps to that one tick.

If you are a WPF Studio customer you can get our default template for the control and update it however you need. But to add a single tick, it may be easier to wrap it in a Grid, and behind the slider center your single tick line and draw the slider on top of that.

3) You can remove the focus rectangle on any control by setting FocusVisualStyle="{x:Null}".


Actipro Software Support

Posted 14 years ago by SledgeHammer01
Avatar
Thanks for the response. I've got it mostly working after playing with it all night and this morning.

1) I did what you suggested and it mostly works save for a few glitches, but easy enough to work around.

2) This one was a pain :). The template for the slider is pretty ugly and you guys don't expose all the necessary styles / brushes, so I ended up just hacking the tick in at runtime in OnApplyTemplate(). Not the right way to do it, I know, but I didn't want to spend a week recreating the template just to insert 2 little rectangles :).

As for the mouse behavior, that turned out to be pretty easy. I just stuck this in a value change handler.

object o = InputHitTest(Mouse.GetPosition(this));

if ((o != null) && IsMouseCaptureWithin && (o is Path))
{
if (Value >= 95 && Value <= 110)
Value = 100;
}

EDIT: I am a customer... I was trying to fix all the references in the extracted style... didn't know I could get a "clean" style. Oh well.

3) Yeah, figured this one out with Expression Blend.
The latest build of this product (v24.1.2) was released 0 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.