Hello,
I create Path from XAML:
Next I want to get Path data from the UIElement and show to the user.
How to get Path data from UIElement?
Hello,
I create Path from XAML:
Next I want to get Path data from the UIElement and show to the user.
How to get Path data from UIElement?
XAML below:
<Path x:Name="myPath" Stroke="DarkGoldenRod" StrokeThickness="3" Margin="0,30,0,0"
Data="M 10,50 h 100 a 20,20 180 0 1 150,0 h 100 v 80 h-100 a 20,20 180 0 1 -150,0 h-100 z" >
</Path >
Hello,
Welcome to our Microsoft Q&A platform!
For Windows Runtime XAML, the move and draw commands produce a PathGeometry, you can get it by using myPath.Data
, the PathGeometry has a single PathFigure object with a Figures property value. Each draw command produces a PathSegment derived class in that single PathFigure's Segments collection, the move command changes the StartPoint, you can get the point value and operation by checking every PathSegment like below. And for more details about Path.Data, you can refer to Move and draw commands syntax.
PathGeometry pp = myPath.Data as PathGeometry;
PathFigureCollection figures = pp.Figures;
foreach (var figure in figures)
{
PathSegmentCollection segs = figure.Segments;
foreach (PathSegment seg in segs)
{
//point or other operation
}
}
In addition, you can refer to this link to check how to add xaml code.
8 people are following this question.
How to write and read multiple types of data using Data Writer and Data Reader
Consuming UWP mail api from WPF Desktop Bridge App
Get Network usage information in UWP apps
How to Get/Set Cookies in Windows.Web.Http API
Switch the ListView Datatemplate from one data template to another data template?