Customizing pointer needles

Gauge for WPF Forum

Posted 16 years ago by D
Version: 4.5.0475
Avatar
Has anyone had any luck adding custom images to pointer needles on a circular gauge? I have been able to add an image, but I've had trouble getting the needle positioned and behaving correctly. I just want a needle that is half one solid color, half another solid color and extending from the center of the gauge outwards.

Currently, my needle is only centered on the gauge so that half of it is on one side of the pointer cap, and half of it is on the other (I want all of it on one side). If someone else has had luck with this, please post a reply. Thanks.

Comments (4)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
If you would like to send over a sample project, we can look into this for you. But keep in mind that since the image is "centered", you would need to have some transparent area on the left side of your image.

For example, if your image is 100x10, then your "needle" should start around 50 along the x-axis. With the pixels below 50 on the x-axis as transparent.

On a side note, you may be able to accomplish the same thing using a custom Geometry (for needles), which would allow for zooming.


Actipro Software Support

Posted 16 years ago by D
Avatar
Out of curiosity, is there any way of customizing the background color of needles? I would much prefer this to using an image overlay. I realize that you can apply gradient effects, but I haven't found anything that would strictly color a needle half solid, half solid with two different colors. Adding gradient stops just didn't produce that desired effect.
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Yes, the needles have a Background property which can be used to set it's color. You can also use a LinearGradientBrush to achieve your desired results. Something like:
<gauge:CircularPointerNeedle.Background>
    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
        <GradientStop Color="Red" Offset="0.0" />
        <GradientStop Color="Red" Offset="0.5" />
        <GradientStop Color="Green" Offset="0.5" />
        <GradientStop Color="Green" Offset="1.0" />
    </LinearGradientBrush>
</gauge:CircularPointerNeedle.Background>


Actipro Software Support

Posted 16 years ago by D
Avatar
Thank you...that was extremely helpful. I guess I just didn't try the right combination with GradientStop. A classic case of making things more complicated than they really are! I've just learned a few extra things along the way, I guess.
The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.