Skip to content

Update to .NET 9 #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Setup XCode
uses: maxim-lobanov/setup-xcode@v1
with:
Expand All @@ -77,7 +77,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Install workloads
run: dotnet workload install android wasm-tools maui-android
- name: Install Android tools
Expand Down
17 changes: 7 additions & 10 deletions Source/OxyPlot.Maui.Skia/OxyPlot.Maui.Skia.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

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

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

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'">
<PropertyGroup Condition="$(TargetFramework.Contains('-ios')) and $(Configuration)=='Debug'">
<CreatePackage>false</CreatePackage>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="OxyPlot.Core" Version="2.2.0" />
<PackageReference Include="SkiaSharp.HarfBuzz" Version="2.88.8" />
<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="2.88.8" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net8.0')) ">
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.70" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
<None Include="..\..\icon.png" Pack="true" PackagePath="\" />
Expand Down
12 changes: 6 additions & 6 deletions Source/OxyPlot.Maui.Skia/PlotViewBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public abstract partial class PlotViewBase : BaseTemplatedView<Grid>, IPlotView
public event Action UpdateFinished;
public event Action RenderStarted;
public event Action RenderFinished;

private int mainThreadId = 1;

protected override void OnControlInitialized(Grid control)
Expand Down Expand Up @@ -74,7 +74,7 @@ protected override void OnControlInitialized(Grid control)
/// </summary>
protected PlotViewBase()
{
this.TrackerDefinitions = new ObservableCollection<TrackerDefinition>();
TrackerDefinitions = new ObservableCollection<TrackerDefinition>();

DefaultTrackerTemplate = new ControlTemplate(() =>
{
Expand All @@ -84,7 +84,7 @@ protected PlotViewBase()
tc.Content = TrackerControl.DefaultTrackerTemplateContentProvider();
return tc;
});
this.LayoutChanged += this.OnLayoutUpdated;
SizeChanged += OnSizeUpdated;
}

/// <summary>
Expand Down Expand Up @@ -147,14 +147,14 @@ public void InvalidatePlot(bool updateData = true)
{
return;
}

UpdateStarted?.Invoke();

lock (this.ActualModel.SyncRoot)
{
((IPlotModel)this.ActualModel).Update(updateData);
}

UpdateFinished?.Invoke();

this.BeginInvoke(this.Render);
Expand Down Expand Up @@ -452,7 +452,7 @@ private bool IsInVisualTree()
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The event args.</param>
private void OnLayoutUpdated(object sender, EventArgs e)
private void OnSizeUpdated(object sender, EventArgs e)
{
// if we were not in the visual tree the last time we tried to render but are now, we have to render
if (!this.isInVisualTree && this.IsInVisualTree())
Expand Down
4 changes: 4 additions & 0 deletions Source/OxyPlot.Maui.Skia/Tracker/TrackerControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,11 @@ private void UpdatePositionAndBorder()

var canvasWidth = parent.Width;
var canvasHeight = parent.Height;
#if NET9_0_OR_GREATER
var contentSize = content.Measure(canvasWidth, canvasHeight);
#else
var contentSize = content.Measure(canvasWidth, canvasHeight).Request;
#endif

var contentWidth = contentSize.Width;
var contentHeight = contentSize.Height;
Expand Down
9 changes: 7 additions & 2 deletions Source/OxyplotMauiSample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
namespace OxyplotMauiSample

namespace OxyplotMauiSample
{
public partial class App
{
public App()
{
InitializeComponent();
MainPage = new AppShell();
}

protected override Window CreateWindow(IActivationState activationState)
{
return new Window(new AppShell());
}
}
}
17 changes: 7 additions & 10 deletions Source/OxyplotMauiSample/OxyplotMauiSample.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">12.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">15.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'">
<PropertyGroup Condition="$(TargetFramework.Contains('-ios'))">
<CreatePackage>false</CreatePackage>
</PropertyGroup>
<ItemGroup>
Expand Down Expand Up @@ -65,7 +62,7 @@

<ItemGroup>
<PackageReference Include="OxyPlot.ExampleLibrary" Version="2.2.0" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.70" />
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
106 changes: 67 additions & 39 deletions Source/OxyplotMauiSample/Pages/CustomTrackerPage.xaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,72 @@
<?xml version="1.0" encoding="UTF-8" ?>
<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">
<oxy:PlotView x:Name="PlotView">
<oxy:PlotView.DefaultTrackerTemplate>
<ControlTemplate>
<oxy:TrackerControl
Background="#DC393838"
BorderBrush="Lime"
BorderThickness="1"
CornerRadius="4"
LineDashArray="1,1"
LineExtents="{Binding PlotModel.PlotArea}"
LineStroke="Gold"
Position="{Binding Position}"
ShowPointer="False">
<Grid HorizontalOptions="Center" VerticalOptions="Center">
<VerticalStackLayout>
<VisualElement.Resources>
<Style TargetType="Label">
<Setter Property="TextColor" Value="White" />
</Style>
</VisualElement.Resources>
<Label HorizontalOptions="Center" Text="{Binding Series.Title}" />
<BoxView Margin="4,0" HeightRequest="1" Color="WhiteSmoke" />
<Grid Margin="5" ColumnDefinitions="Auto,Auto" RowDefinitions="Auto,Auto,Auto,Auto">
<Label Grid.Row="0" Grid.Column="0" Text="DataPoint.X:" />
<Label Grid.Row="0" Grid.Column="1" Text="{Binding DataPoint.X, StringFormat='{0:F3}'}" />
<ContentPage x:Class="OxyplotMauiSample.CustomTrackerPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:ox="clr-namespace:OxyPlot;assembly=OxyPlot"
xmlns:oxy="clr-namespace:OxyPlot.Maui.Skia;assembly=OxyPlot.Maui.Skia">
<oxy:PlotView x:Name="PlotView">
<oxy:PlotView.DefaultTrackerTemplate>
<ControlTemplate>
<oxy:TrackerControl
x:DataType="ox:TrackerHitResult"
Background="#DC393838"
BorderBrush="Lime"
BorderThickness="1"
CornerRadius="4"
LineDashArray="1,1"
LineExtents="{Binding PlotModel.PlotArea}"
LineStroke="Gold"
Position="{Binding Position}"
ShowPointer="False">
<Grid HorizontalOptions="Center"
VerticalOptions="Center">
<VerticalStackLayout>
<VisualElement.Resources>
<Style TargetType="Label">
<Setter Property="TextColor"
Value="White"/>
</Style>
</VisualElement.Resources>
<Label HorizontalOptions="Center"
Text="{Binding Series.Title}"/>
<BoxView Margin="4,0"
HeightRequest="1"
Color="WhiteSmoke"/>
<Grid Margin="5"
ColumnDefinitions="Auto,Auto"
RowDefinitions="Auto,Auto,Auto,Auto">
<Label Grid.Row="0"
Grid.Column="0"
Text="DataPoint.X:"/>
<Label Grid.Row="0"
Grid.Column="1"
Text="{Binding DataPoint.X, StringFormat='{0:F3}'}"/>

<Label Grid.Row="1" Grid.Column="0" Text="DataPoint.Y:" />
<Label Grid.Row="1" Grid.Column="1" Text="{Binding DataPoint.Y, StringFormat='{0:F3}'}" />
<Label Grid.Row="1"
Grid.Column="0"
Text="DataPoint.Y:"/>
<Label Grid.Row="1"
Grid.Column="1"
Text="{Binding DataPoint.Y, StringFormat='{0:F3}'}"/>

<Label Grid.Row="2" Grid.Column="0" Text="Position.X:" />
<Label Grid.Row="2" Grid.Column="1" Text="{Binding Position.X, StringFormat='{0:F1}'}" />
<Label Grid.Row="2"
Grid.Column="0"
Text="Position.X:"/>
<Label Grid.Row="2"
Grid.Column="1"
Text="{Binding Position.X, StringFormat='{0:F1}'}"/>

<Label Grid.Row="3" Grid.Column="0" Text="Position.Y:" />
<Label Grid.Row="3" Grid.Column="1" Text="{Binding Position.Y, StringFormat='{0:F1}'}" />
</Grid>
</VerticalStackLayout>
</Grid>
</oxy:TrackerControl>
</ControlTemplate>
</oxy:PlotView.DefaultTrackerTemplate>
</oxy:PlotView>
<Label Grid.Row="3"
Grid.Column="0"
Text="Position.Y:"/>
<Label Grid.Row="3"
Grid.Column="1"
Text="{Binding Position.Y, StringFormat='{0:F1}'}"/>
</Grid>
</VerticalStackLayout>
</Grid>
</oxy:TrackerControl>
</ControlTemplate>
</oxy:PlotView.DefaultTrackerTemplate>
</oxy:PlotView>
</ContentPage>
6 changes: 3 additions & 3 deletions Source/OxyplotMauiSample/Pages/IssueDemos/IssueDemoPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
Title="Select demo">
<ListView
x:Name="list1"
x:DataType="oxyplotMauiSample:DemoInfo"
HorizontalOptions="Fill"
ItemTapped="ListView_OnItemTapped"
VerticalOptions="Fill">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Detail="{Binding Details}" Text="{Binding Title}" />
<DataTemplate x:DataType="oxyplotMauiSample:DemoInfo">
<TextCell Detail="{Binding Details}"
Text="{Binding Title}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
<ContentPage 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"
x:Class="OxyplotMauiSample.AllBackgroundColorsSet" BackgroundColor="Yellow">
xmlns:local="clr-namespace:OxyplotMauiSample"
x:Class="OxyplotMauiSample.AllBackgroundColorsSet"
x:DataType="local:AllBackgroundColorsSet"
BackgroundColor="Yellow">
<StackLayout>
<oxy:PlotView BackgroundColor="Blue" Model="{Binding Model}" HeightRequest="200"/>
<oxy:PlotView
BackgroundColor="Blue"
Model="{Binding Model}"
HeightRequest="200"/>
</StackLayout>
</ContentPage>
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<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">
<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"
xmlns:local="clr-namespace:OxyplotMauiSample"
x:DataType="local:ChangeVisibility">
<StackLayout>
<Switch BindingContext="{x:Reference Name=plotView1}" IsToggled="{Binding Path=IsVisible}" />
<Switch BindingContext="{x:Reference Name=plotView1}"
IsToggled="{Binding Path=IsVisible}"/>
<oxy:PlotView
x:Name="plotView1"
HeightRequest="200"
HorizontalOptions="Fill"
IsVisible="True"
Model="{Binding Model}" />
Model="{Binding Model}"/>
</StackLayout>
</ContentPage>
Loading
Loading