-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainPage.xaml
91 lines (86 loc) · 4.08 KB
/
MainPage.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="PathGradientRepro.MainPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<ScrollView>
<VerticalStackLayout Margin="30,0" Spacing="35">
<VerticalStackLayout.Resources>
<ResourceDictionary>
<LinearGradientBrush x:Key="LinearGradient">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0" Color="Red" />
<GradientStop Offset="0.5" Color="Blue" />
<GradientStop Offset="0.9" Color="Purple" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<RadialGradientBrush x:Key="RadialGradient">
<RadialGradientBrush.GradientStops>
<GradientStop Offset="0" Color="Red" />
<GradientStop Offset="0.5" Color="Blue" />
<GradientStop Offset="0.9" Color="Purple" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</ResourceDictionary>
</VerticalStackLayout.Resources>
<VerticalStackLayout Margin="30,0" Spacing="35">
<Label Text="Non-working (Stroke does not apply gradient)" />
<Path
x:Name="ArcPath"
Fill="{StaticResource LinearGradient}"
Stroke="{StaticResource LinearGradient}"
StrokeThickness="20">
<Path.Data>
<PathGeometry>
<PathFigureCollection>
<PathFigure StartPoint="0,0">
<ArcSegment
IsLargeArc="False"
Point="120,140"
Size="100,100"
SweepDirection="Clockwise" />
</PathFigure>
</PathFigureCollection>
</PathGeometry>
</Path.Data>
</Path>
<Ellipse
Fill="{StaticResource LinearGradient}"
HeightRequest="50"
Stroke="{StaticResource LinearGradient}"
StrokeThickness="10"
WidthRequest="50" />
</VerticalStackLayout>
<VerticalStackLayout Margin="30,0" Spacing="35">
<Label Text="Working (Border does apply gradient)" />
<Border
HeightRequest="100"
Stroke="{StaticResource LinearGradient}"
StrokeShape="RoundRectangle 15"
StrokeThickness="20"
WidthRequest="100" />
<Border
HeightRequest="400"
Stroke="{StaticResource LinearGradient}"
StrokeThickness="20"
WidthRequest="400">
<Border.StrokeShape>
<Path Fill="{StaticResource LinearGradient}">
<Path.Data>
<PathGeometry>
<PathFigure StartPoint="0,0">
<ArcSegment
IsLargeArc="False"
Point="120,140"
Size="100,100"
SweepDirection="Clockwise" />
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>
</Border.StrokeShape>
</Border>
</VerticalStackLayout>
</VerticalStackLayout>
</ScrollView>
</ContentPage>