Cloning a path
What is the best way to clone a path, including all properties, and insert it just below the original (not as a child)? I can copy the data string and copy the properties one by one but I noticed that there is a Clone function available in NoesisGUI C# which unfortunately goes undocumented.
-
-
sfernandez
Site Admin
- Posts: 2056
- Joined:
Re: Cloning a path
The Freezable.Clone method can be used to create a deep copy of Path's geometry:
But Path element can't be cloned, so if you need to do that then you have to copy the necessary properties yourself.
Code: Select all
Geometry g = path.Data.Clone();
Code: Select all
Path copy = new Path();
copy.Data = path.Data; // this will share the same geometry, use Clone if you want a copy
copy.Fill = path.Fill; // idem
copy.Stroke = path.Stroke; // idem
copy.StrokeThickness = path.StrokeThickness;
...
Who is online
Users browsing this forum: No registered users and 2 guests