Pankaj Deharia

Pankaj Deharia

  • NA
  • 38
  • 508

How to achieve Grouping and Ungrouping Canvas programmatical

Nov 11 2016 1:27 AM
I want to group , ungroup canvas user control in wpf application.Though this can be achieved with microsoft visual studio in built function Group and Ungroup which we get from Object and Timeline window.Through ungrouping we are removing unwanted canvas and making only one parent(canvas) to child controls.
Phis i need to achieve programmatically.Please suggest how can I achieve this through programmatically though I want to process my xaml file without doing this manual step and handle it through code behind.

Below mentioned is code snippet of xaml data which is not yet grouped and after that grouping.

Code before ungrouping :

<Canvas Name="_01" RenderTransform="1, 0, 0, 1, 130.919685, -4.32">
<Canvas Name="_64" RenderTransform="-0.999991, 0.004316, -0.004316, -0.999991, 14.637921, 2145.991988">
<Path Name="_64_G0__MrkrEnd" Visibility="Collapsed" RenderTransform="3.31258, -1.721798, -1.721798, -3.31258, 5.998991, 1066.51392" StrokeLineJoin="Round" Data="M -1 -1 L 0 0 L 1 -1 ">
</Path>
</Canvas>
</Canvas>

Code after Ungrouping and grouping into a canvas, which allow a single parent node to the child.

<Canvas Name="_01" RenderTransform="1, 0, 0, 1, 130.919685, -4.32">
<Path x:Name="_64_G0__MrkrEnd" Visibility="Collapsed" StrokeLineJoin="Round" Data="M -1 -1 L 0 0 L 1 -1 " Canvas.Left="14.637" RenderTransformOrigin="0.5,0.5" Canvas.Top="2145.992"/>
</Canvas>

Answers (1)