Search code examples
wpftransformpathgeometryscatterview

WPF TranslateTransform is ScaleTransforming


In the following code part is Part class's object which is inherited from ScatterViewItem class (Microsoft.Surface.Presentation.Controls). part.Content is Path geometry:

GeometryGroup gGroup = new GeometryGroup
{
    FillRule = FillRule.Nonzero
};
foreach(KeyValuePair<int, Part> kv in Layers)
{
    geom = part.ShadowPath.RenderedGeometry.Clone();
    geom.Transform = new TranslateTransform(0, 0);
    gGroup.Children.Add(geom);
}

When I comment geom.Transform = new TranslateTransform(0, 0); line, it shows with right scale but when I uncomment it, although I am not changing anything, it scales paths: enter image description here

I want to know how to fix it.


Solution

  • @Clemens was right about initial transformation values: there was matrixTransform with automatically calculated values by WPF. When I assigned new transformation values, it totally removed old values. I just picked that matrix and updated some values and it worked fine.