Skip to content

Commit 46a1644

Browse files
authored
Merge pull request #22 from janusw/net9
Update to .NET 9
2 parents 2d4738d + da0c220 commit 46a1644

14 files changed

+144
-86
lines changed

.github/workflows/dotnet.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup .NET
2121
uses: actions/setup-dotnet@v4
2222
with:
23-
dotnet-version: 8.0.x
23+
dotnet-version: 9.0.x
2424
- name: Set up JDK 11
2525
uses: actions/setup-java@v4
2626
with:
@@ -51,7 +51,7 @@ jobs:
5151
- name: Setup .NET
5252
uses: actions/setup-dotnet@v4
5353
with:
54-
dotnet-version: 8.0.x
54+
dotnet-version: 9.0.x
5555
- name: Setup XCode
5656
uses: maxim-lobanov/setup-xcode@v1
5757
with:
@@ -77,7 +77,7 @@ jobs:
7777
- name: Setup .NET
7878
uses: actions/setup-dotnet@v4
7979
with:
80-
dotnet-version: 8.0.x
80+
dotnet-version: 9.0.x
8181
- name: Install workloads
8282
run: dotnet workload install android wasm-tools maui-android
8383
- name: Install Android tools

Source/OxyPlot.Maui.Skia/OxyPlot.Maui.Skia.csproj

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0;net8.0-android34.0</TargetFrameworks>
5-
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
6-
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net8.0-android34.0;net9.0;net9.0-android</TargetFrameworks>
5+
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);net8.0-ios;net8.0-maccatalyst;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
6+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0;net9.0-windows10.0.19041.0</TargetFrameworks>
77
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
88
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
99
<UseMaui>true</UseMaui>
1010
<SingleProject>true</SingleProject>
1111
<ImplicitUsings>enable</ImplicitUsings>
1212

13-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
14-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
13+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">12.2</SupportedOSPlatformVersion>
14+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
1515
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
1616
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
1717
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
@@ -30,19 +30,16 @@
3030
<RepositoryUrl>https://github.com/oxyplot/oxyplot-maui</RepositoryUrl>
3131
</PropertyGroup>
3232

33-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'">
33+
<PropertyGroup Condition="$(TargetFramework.Contains('-ios')) and $(Configuration)=='Debug'">
3434
<CreatePackage>false</CreatePackage>
3535
</PropertyGroup>
3636
<ItemGroup>
37+
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
3738
<PackageReference Include="OxyPlot.Core" Version="2.2.0" />
3839
<PackageReference Include="SkiaSharp.HarfBuzz" Version="2.88.8" />
3940
<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="2.88.8" />
4041
</ItemGroup>
4142

42-
<ItemGroup Condition=" $(TargetFramework.StartsWith('net8.0')) ">
43-
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.70" />
44-
</ItemGroup>
45-
4643
<ItemGroup>
4744
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
4845
<None Include="..\..\icon.png" Pack="true" PackagePath="\" />

Source/OxyPlot.Maui.Skia/PlotViewBase.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public abstract partial class PlotViewBase : BaseTemplatedView<Grid>, IPlotView
88
public event Action UpdateFinished;
99
public event Action RenderStarted;
1010
public event Action RenderFinished;
11-
11+
1212
private int mainThreadId = 1;
1313

1414
protected override void OnControlInitialized(Grid control)
@@ -74,7 +74,7 @@ protected override void OnControlInitialized(Grid control)
7474
/// </summary>
7575
protected PlotViewBase()
7676
{
77-
this.TrackerDefinitions = new ObservableCollection<TrackerDefinition>();
77+
TrackerDefinitions = new ObservableCollection<TrackerDefinition>();
7878

7979
DefaultTrackerTemplate = new ControlTemplate(() =>
8080
{
@@ -84,7 +84,7 @@ protected PlotViewBase()
8484
tc.Content = TrackerControl.DefaultTrackerTemplateContentProvider();
8585
return tc;
8686
});
87-
this.LayoutChanged += this.OnLayoutUpdated;
87+
SizeChanged += OnSizeUpdated;
8888
}
8989

9090
/// <summary>
@@ -147,14 +147,14 @@ public void InvalidatePlot(bool updateData = true)
147147
{
148148
return;
149149
}
150-
150+
151151
UpdateStarted?.Invoke();
152152

153153
lock (this.ActualModel.SyncRoot)
154154
{
155155
((IPlotModel)this.ActualModel).Update(updateData);
156156
}
157-
157+
158158
UpdateFinished?.Invoke();
159159

160160
this.BeginInvoke(this.Render);
@@ -452,7 +452,7 @@ private bool IsInVisualTree()
452452
/// </summary>
453453
/// <param name="sender">The sender.</param>
454454
/// <param name="e">The event args.</param>
455-
private void OnLayoutUpdated(object sender, EventArgs e)
455+
private void OnSizeUpdated(object sender, EventArgs e)
456456
{
457457
// if we were not in the visual tree the last time we tried to render but are now, we have to render
458458
if (!this.isInVisualTree && this.IsInVisualTree())

Source/OxyPlot.Maui.Skia/Tracker/TrackerControl.xaml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,11 @@ private void UpdatePositionAndBorder()
372372

373373
var canvasWidth = parent.Width;
374374
var canvasHeight = parent.Height;
375+
#if NET9_0_OR_GREATER
376+
var contentSize = content.Measure(canvasWidth, canvasHeight);
377+
#else
375378
var contentSize = content.Measure(canvasWidth, canvasHeight).Request;
379+
#endif
376380

377381
var contentWidth = contentSize.Width;
378382
var contentHeight = contentSize.Height;

Source/OxyplotMauiSample/App.xaml.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
namespace OxyplotMauiSample
1+

2+
namespace OxyplotMauiSample
23
{
34
public partial class App
45
{
56
public App()
67
{
78
InitializeComponent();
8-
MainPage = new AppShell();
9+
}
10+
11+
protected override Window CreateWindow(IActivationState activationState)
12+
{
13+
return new Window(new AppShell());
914
}
1015
}
1116
}

Source/OxyplotMauiSample/OxyplotMauiSample.csproj

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0-android34.0</TargetFrameworks>
5-
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
6-
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
4+
<TargetFrameworks>net9.0-android</TargetFrameworks>
5+
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('linux'))">$(TargetFrameworks);net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
6+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
77
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
88
<!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
99
<OutputType>Exe</OutputType>
@@ -23,18 +23,15 @@
2323
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
2424
<ApplicationVersion>1</ApplicationVersion>
2525

26-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
27-
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
26+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">12.2</SupportedOSPlatformVersion>
27+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
2828
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
2929
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
3030
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
3131
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
3232
</PropertyGroup>
3333

34-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'">
35-
<CreatePackage>false</CreatePackage>
36-
</PropertyGroup>
37-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'">
34+
<PropertyGroup Condition="$(TargetFramework.Contains('-ios'))">
3835
<CreatePackage>false</CreatePackage>
3936
</PropertyGroup>
4037
<ItemGroup>
@@ -65,7 +62,7 @@
6562

6663
<ItemGroup>
6764
<PackageReference Include="OxyPlot.ExampleLibrary" Version="2.2.0" />
68-
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.70" />
65+
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
6966
</ItemGroup>
7067

7168
<ItemGroup>
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/IssueDemoPage.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
Title="Select demo">
88
<ListView
99
x:Name="list1"
10-
x:DataType="oxyplotMauiSample:DemoInfo"
1110
HorizontalOptions="Fill"
1211
ItemTapped="ListView_OnItemTapped"
1312
VerticalOptions="Fill">
1413
<ListView.ItemTemplate>
15-
<DataTemplate>
16-
<TextCell Detail="{Binding Details}" Text="{Binding Title}" />
14+
<DataTemplate x:DataType="oxyplotMauiSample:DemoInfo">
15+
<TextCell Detail="{Binding Details}"
16+
Text="{Binding Title}"/>
1717
</DataTemplate>
1818
</ListView.ItemTemplate>
1919
</ListView>

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>

0 commit comments

Comments
 (0)