Skip to content

Commit e2e2d24

Browse files
committed
OxyplotMauiSample: fix several warnings
XamlC warning XC0022: Binding could be compiled to improve runtime performance if x:DataType is specified. See https://learn.microsoft.com/dotnet/maui/fundamentals/data-binding/compiled-bindings for more information. (includes auto-formatting via prettier)
1 parent 18335f2 commit e2e2d24

File tree

7 files changed

+107
-52
lines changed

7 files changed

+107
-52
lines changed
Lines changed: 67 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,72 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
2-
<ContentPage x:Class="OxyplotMauiSample.CustomTrackerPage" xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:oxy="clr-namespace:OxyPlot.Maui.Skia;assembly=OxyPlot.Maui.Skia">
3-
<oxy:PlotView x:Name="PlotView">
4-
<oxy:PlotView.DefaultTrackerTemplate>
5-
<ControlTemplate>
6-
<oxy:TrackerControl
7-
Background="#DC393838"
8-
BorderBrush="Lime"
9-
BorderThickness="1"
10-
CornerRadius="4"
11-
LineDashArray="1,1"
12-
LineExtents="{Binding PlotModel.PlotArea}"
13-
LineStroke="Gold"
14-
Position="{Binding Position}"
15-
ShowPointer="False">
16-
<Grid HorizontalOptions="Center" VerticalOptions="Center">
17-
<VerticalStackLayout>
18-
<VisualElement.Resources>
19-
<Style TargetType="Label">
20-
<Setter Property="TextColor" Value="White" />
21-
</Style>
22-
</VisualElement.Resources>
23-
<Label HorizontalOptions="Center" Text="{Binding Series.Title}" />
24-
<BoxView Margin="4,0" HeightRequest="1" Color="WhiteSmoke" />
25-
<Grid Margin="5" ColumnDefinitions="Auto,Auto" RowDefinitions="Auto,Auto,Auto,Auto">
26-
<Label Grid.Row="0" Grid.Column="0" Text="DataPoint.X:" />
27-
<Label Grid.Row="0" Grid.Column="1" Text="{Binding DataPoint.X, StringFormat='{0:F3}'}" />
2+
<ContentPage x:Class="OxyplotMauiSample.CustomTrackerPage"
3+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
5+
xmlns:ox="clr-namespace:OxyPlot;assembly=OxyPlot"
6+
xmlns:oxy="clr-namespace:OxyPlot.Maui.Skia;assembly=OxyPlot.Maui.Skia">
7+
<oxy:PlotView x:Name="PlotView">
8+
<oxy:PlotView.DefaultTrackerTemplate>
9+
<ControlTemplate>
10+
<oxy:TrackerControl
11+
x:DataType="ox:TrackerHitResult"
12+
Background="#DC393838"
13+
BorderBrush="Lime"
14+
BorderThickness="1"
15+
CornerRadius="4"
16+
LineDashArray="1,1"
17+
LineExtents="{Binding PlotModel.PlotArea}"
18+
LineStroke="Gold"
19+
Position="{Binding Position}"
20+
ShowPointer="False">
21+
<Grid HorizontalOptions="Center"
22+
VerticalOptions="Center">
23+
<VerticalStackLayout>
24+
<VisualElement.Resources>
25+
<Style TargetType="Label">
26+
<Setter Property="TextColor"
27+
Value="White"/>
28+
</Style>
29+
</VisualElement.Resources>
30+
<Label HorizontalOptions="Center"
31+
Text="{Binding Series.Title}"/>
32+
<BoxView Margin="4,0"
33+
HeightRequest="1"
34+
Color="WhiteSmoke"/>
35+
<Grid Margin="5"
36+
ColumnDefinitions="Auto,Auto"
37+
RowDefinitions="Auto,Auto,Auto,Auto">
38+
<Label Grid.Row="0"
39+
Grid.Column="0"
40+
Text="DataPoint.X:"/>
41+
<Label Grid.Row="0"
42+
Grid.Column="1"
43+
Text="{Binding DataPoint.X, StringFormat='{0:F3}'}"/>
2844

29-
<Label Grid.Row="1" Grid.Column="0" Text="DataPoint.Y:" />
30-
<Label Grid.Row="1" Grid.Column="1" Text="{Binding DataPoint.Y, StringFormat='{0:F3}'}" />
45+
<Label Grid.Row="1"
46+
Grid.Column="0"
47+
Text="DataPoint.Y:"/>
48+
<Label Grid.Row="1"
49+
Grid.Column="1"
50+
Text="{Binding DataPoint.Y, StringFormat='{0:F3}'}"/>
3151

32-
<Label Grid.Row="2" Grid.Column="0" Text="Position.X:" />
33-
<Label Grid.Row="2" Grid.Column="1" Text="{Binding Position.X, StringFormat='{0:F1}'}" />
52+
<Label Grid.Row="2"
53+
Grid.Column="0"
54+
Text="Position.X:"/>
55+
<Label Grid.Row="2"
56+
Grid.Column="1"
57+
Text="{Binding Position.X, StringFormat='{0:F1}'}"/>
3458

35-
<Label Grid.Row="3" Grid.Column="0" Text="Position.Y:" />
36-
<Label Grid.Row="3" Grid.Column="1" Text="{Binding Position.Y, StringFormat='{0:F1}'}" />
37-
</Grid>
38-
</VerticalStackLayout>
39-
</Grid>
40-
</oxy:TrackerControl>
41-
</ControlTemplate>
42-
</oxy:PlotView.DefaultTrackerTemplate>
43-
</oxy:PlotView>
59+
<Label Grid.Row="3"
60+
Grid.Column="0"
61+
Text="Position.Y:"/>
62+
<Label Grid.Row="3"
63+
Grid.Column="1"
64+
Text="{Binding Position.Y, StringFormat='{0:F1}'}"/>
65+
</Grid>
66+
</VerticalStackLayout>
67+
</Grid>
68+
</oxy:TrackerControl>
69+
</ControlTemplate>
70+
</oxy:PlotView.DefaultTrackerTemplate>
71+
</oxy:PlotView>
4472
</ContentPage>

Source/OxyplotMauiSample/Pages/IssueDemos/Pages/AllBackgroundColorsSet.xaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
44
xmlns:oxy="clr-namespace:OxyPlot.Maui.Skia;assembly=OxyPlot.Maui.Skia"
5-
x:Class="OxyplotMauiSample.AllBackgroundColorsSet" BackgroundColor="Yellow">
5+
xmlns:local="clr-namespace:OxyplotMauiSample"
6+
x:Class="OxyplotMauiSample.AllBackgroundColorsSet"
7+
x:DataType="local:AllBackgroundColorsSet"
8+
BackgroundColor="Yellow">
69
<StackLayout>
7-
<oxy:PlotView BackgroundColor="Blue" Model="{Binding Model}" HeightRequest="200"/>
10+
<oxy:PlotView
11+
BackgroundColor="Blue"
12+
Model="{Binding Model}"
13+
HeightRequest="200"/>
814
</StackLayout>
915
</ContentPage>
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
<?xml version="1.0" encoding="utf-8" ?>
2-
<ContentPage x:Class="OxyplotMauiSample.ChangeVisibility" xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:oxy="clr-namespace:OxyPlot.Maui.Skia;assembly=OxyPlot.Maui.Skia">
2+
<ContentPage x:Class="OxyplotMauiSample.ChangeVisibility"
3+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
5+
xmlns:oxy="clr-namespace:OxyPlot.Maui.Skia;assembly=OxyPlot.Maui.Skia"
6+
xmlns:local="clr-namespace:OxyplotMauiSample"
7+
x:DataType="local:ChangeVisibility">
38
<StackLayout>
4-
<Switch BindingContext="{x:Reference Name=plotView1}" IsToggled="{Binding Path=IsVisible}" />
9+
<Switch BindingContext="{x:Reference Name=plotView1}"
10+
IsToggled="{Binding Path=IsVisible}"/>
511
<oxy:PlotView
612
x:Name="plotView1"
713
HeightRequest="200"
814
HorizontalOptions="Fill"
915
IsVisible="True"
10-
Model="{Binding Model}" />
16+
Model="{Binding Model}"/>
1117
</StackLayout>
1218
</ContentPage>
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<?xml version="1.0" encoding="utf-8" ?>
2-
<ContentPage x:Class="OxyplotMauiSample.NoBackgroundColor" xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:oxy="clr-namespace:OxyPlot.Maui.Skia;assembly=OxyPlot.Maui.Skia">
3-
<oxy:PlotView Model="{Binding Model}" />
2+
<ContentPage x:Class="OxyplotMauiSample.NoBackgroundColor"
3+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
5+
xmlns:oxy="clr-namespace:OxyPlot.Maui.Skia;assembly=OxyPlot.Maui.Skia"
6+
xmlns:local="clr-namespace:OxyplotMauiSample"
7+
x:DataType="local:NoBackgroundColor">
8+
<oxy:PlotView Model="{Binding Model}"/>
49
</ContentPage>

Source/OxyplotMauiSample/Pages/IssueDemos/Pages/PageBackgroundColor.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
55
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
66
xmlns:oxy="clr-namespace:OxyPlot.Maui.Skia;assembly=OxyPlot.Maui.Skia"
7+
xmlns:local="clr-namespace:OxyplotMauiSample"
8+
x:DataType="local:PageBackgroundColor"
79
BackgroundColor="Yellow">
8-
<oxy:PlotView Model="{Binding Model}" />
10+
<oxy:PlotView Model="{Binding Model}"/>
911
</ContentPage>
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<?xml version="1.0" encoding="utf-8" ?>
2-
<ContentPage x:Class="OxyplotMauiSample.PlotModelBackground" xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:oxy="clr-namespace:OxyPlot.Maui.Skia;assembly=OxyPlot.Maui.Skia">
3-
<oxy:PlotView Model="{Binding Model}" />
2+
<ContentPage x:Class="OxyplotMauiSample.PlotModelBackground"
3+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
5+
xmlns:oxy="clr-namespace:OxyPlot.Maui.Skia;assembly=OxyPlot.Maui.Skia"
6+
xmlns:local="clr-namespace:OxyplotMauiSample"
7+
x:DataType="local:PlotModelBackground">
8+
<oxy:PlotView Model="{Binding Model}"/>
49
</ContentPage>
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<?xml version="1.0" encoding="utf-8" ?>
2-
<ContentPage
2+
<ContentPage
33
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
44
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
55
xmlns:oxy="clr-namespace:OxyPlot.Maui.Skia;assembly=OxyPlot.Maui.Skia"
6-
x:Class="OxyplotMauiSample.PlotViewBackgroundColor">
7-
<oxy:PlotView BackgroundColor="Blue" Model="{Binding Model}"/>
6+
xmlns:local="clr-namespace:OxyplotMauiSample"
7+
x:Class="OxyplotMauiSample.PlotViewBackgroundColor"
8+
x:DataType="local:PlotViewBackgroundColor">
9+
<oxy:PlotView BackgroundColor="Blue"
10+
Model="{Binding Model}"/>
811
</ContentPage>

0 commit comments

Comments
 (0)