Maintain constant Padding of Diagram.Panel across all zoom levels


I have to maintain constant 5-pixel padding of Diagram.Panel across all zoom levels of diagram.
In our earlier discussion for different requirement,

You have provided two solutions over there. I used first solution for my earlier requirement and it is working fine.

Using the same solution(5-pixel by Diagram.Panel.Scale), i am trying to apply for a padding thickness. But for this case, it is not applied. The padding pixel values are varying for different zoom levels,
For e.g: the below padding are applied for respective zoom levels
200% - 6 5 6 9
300% - 9 5 6 11
400% - 8 7 11 13
500% - 10 9 13 5

Even i tried setting padding as 0, but there are some padding thickness applied.

And i am setting the padding value in IncreaseZoom and DecreaseZoom methods of derived class of CommandHandler.

Is there any other way or am i doing any mistakes in this case of setting the padding?

Thanks in Advance.

Maybe you want to implement that padding outside of the Diagram, rather than inside it.

Are you meaning to set margin instead of the padding?

Maybe. I still don’t understand exactly what you want. I’m just thinking that maybe you can get the “constant space” that you want without having it be subject to scaling by arranging the elements outside of the DiagramPanel rather than within it.

If so, you might find it best to style or replace the Diagram.Template. That way you can arrange it the way that you want. The standard ControlTemplate is given in the Themes/Generic.xaml file.

Hi Walter,

Does that Themes/Generic.xaml available in the Sample sources given by GoXAM?

In the kit it’s been copied to the docs/GenericWPF.xaml file.