Using SnapsToDevicePixels in OnRender

I have a class derived from FrameworkElement

where I override the method OnRender

to draw multiple lines. I would like the behavior to SnapsToDevicePixels

work with my primitive control, what's the best way to do this?

I know GuidelineSet

how to use them as well, but looking at some of the sample elements in the .NET Reference Source they weren't used and I didn't see anything that counted SnapsToDevicePixels

in the overrides OnRender

. Only a few parts UIElement

do anything with it in the method Arrange

, but the property works on Rectangle

s.

It seems to me that checking the property SnapsToDevicePixels

is equal true

and then clicking GuidelineSet

on drawingContext

would be a naive approach, and I thought (hoped) there was a better way to enable it.

This is true? If so, how should I develop methods OnRender

to use SnapsToDevicePixels

?

+3


source to share





All Articles