admin管理员组文章数量:1278988
Controls -> Views -> Shapes -> Paths -> Path class is not working properly though I have written correct code:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns=";
xmlns:x=";
x:Class="_23_Path.MainPage"
Title="MainPage">
<ScrollView>
<StackLayout>
<!-- Example 1-->
<Label Text="Example 1" />
<Path Stroke="Black" Aspect="Uniform" HorizontalOptions="Start">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure IsClosed="True"
StartPoint="10,100">
<PathFigure.Segments>
<PathSegmentCollection>
<LineSegment Point="100,100" />
<LineSegment Point="100,50" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
</StackLayout>
</ScrollView>
</ContentPage>
See this code, after running in the android simulation it is not showing the drawing!
Expecting a output of the path image.
Controls -> Views -> Shapes -> Paths -> Path class is not working properly though I have written correct code:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft/winfx/2009/xaml"
x:Class="_23_Path.MainPage"
Title="MainPage">
<ScrollView>
<StackLayout>
<!-- Example 1-->
<Label Text="Example 1" />
<Path Stroke="Black" Aspect="Uniform" HorizontalOptions="Start">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure IsClosed="True"
StartPoint="10,100">
<PathFigure.Segments>
<PathSegmentCollection>
<LineSegment Point="100,100" />
<LineSegment Point="100,50" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
</StackLayout>
</ScrollView>
</ContentPage>
See this code, after running in the android simulation it is not showing the drawing!
Expecting a output of the path image.
Share Improve this question edited Feb 24 at 10:43 marc_s 755k184 gold badges1.4k silver badges1.5k bronze badges asked Feb 24 at 10:02 S MajumderS Majumder 11 bronze badge 02 Answers
Reset to default 0I see that your example is following the documentation on https://learn.microsoft/en-us/dotnet/maui/user-interface/controls/shapes/path?view=net-maui-9.0 - I have used the Path syntax extensively and you can see several of my StackOverflow posts based on Path. I would recommend trying these things:
- Ensuring that the Path has a defined Width and Height (e.g. set WidthRequest and HeightRequest, or put it in a Grid where the Grid dimensions are set)
- Try a different color, e.g. Red, to avoid the possibility of drawing Black on Black.
Here are some of my StackOverflow posts: https://stackoverflow/search?q=user%3A881441+path+%5Bmaui%5D
I have found the issue, if we remove the property 'HorizontalOptions="Start" ' from the Path class the image is showing! Somebody try this code, and let me know is it working on your system or not with .NET9 and .NET 8 also.
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft/winfx/2009/xaml"
x:Class="_23_Path.MainPage">
<ScrollView>
<Path Data="M 10, 100 L 100, 100 100, 50Z" Stroke="Black" Aspect="Uniform" />
</ScrollView>
</ContentPage>
本文标签: cPath is not working in NET MAUI with NET 9Stack Overflow
版权声明:本文标题:c# - Path is not working in .NET MAUI with .NET 9 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741280041a2369954.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论