Update library and samples to use Xamarin.Forms 5

This commit is contained in:
Javier Suárez Ruiz 2021-10-03 18:29:25 +02:00
Родитель f591f033e6
Коммит 7b317a358b
27 изменённых файлов: 95 добавлений и 70 удалений

Просмотреть файл

@ -21,7 +21,6 @@ namespace TemplateUI.Gallery.Droid
base.OnCreate(savedInstanceState);
Forms.SetFlags("Brush_Experimental", "Shapes_Experimental");
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
Forms.Init(this, savedInstanceState);
LoadApplication(new App());

Просмотреть файл

@ -16,7 +16,7 @@
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
@ -53,8 +53,8 @@
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.7.0.1351" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2125" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
<PackageReference Include="Xamarin.Forms.FontAwesome.Brand">
<Version>1.0.0</Version>
</PackageReference>

Просмотреть файл

@ -19,7 +19,6 @@ namespace TemplateUI.Gallery.iOS
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
Forms.SetFlags("Shapes_Experimental");
Forms.Init();
LoadApplication(new App());

Просмотреть файл

@ -124,8 +124,8 @@
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.7.0.1351" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2125" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
<PackageReference Include="Xamarin.Forms.FontAwesome.Brand">
<Version>1.0.0</Version>
</PackageReference>

Просмотреть файл

@ -30,7 +30,6 @@ namespace TemplateUI.Gallery.macOS
public override void DidFinishLaunching(NSNotification notification)
{
Forms.SetFlags("Shapes_Experimental");
Forms.Init();
LoadApplication(new App());
base.DidFinishLaunching(notification);

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.props" Condition="Exists('..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.props')" />
<Import Project="..\packages\Xamarin.Forms.5.0.0.2125\build\Xamarin.Forms.props" Condition="Exists('..\packages\Xamarin.Forms.5.0.0.2125\build\Xamarin.Forms.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -67,17 +67,20 @@
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\packages\Xamarin.Forms.4.7.0.1351\lib\Xamarin.Mac\Xamarin.Forms.Core.dll</HintPath>
<HintPath>..\packages\Xamarin.Forms.5.0.0.2125\lib\Xamarin.Mac\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\packages\Xamarin.Forms.4.7.0.1351\lib\Xamarin.Mac\Xamarin.Forms.Platform.dll</HintPath>
<HintPath>..\packages\Xamarin.Forms.5.0.0.2125\lib\Xamarin.Mac\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\packages\Xamarin.Forms.4.7.0.1351\lib\Xamarin.Mac\Xamarin.Forms.Xaml.dll</HintPath>
<HintPath>..\packages\Xamarin.Forms.5.0.0.2125\lib\Xamarin.Mac\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Essentials">
<HintPath>..\packages\Xamarin.Essentials.1.3.1\lib\netstandard2.0\Xamarin.Essentials.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform.macOS">
<HintPath>..\packages\Xamarin.Forms.5.0.0.2125\lib\Xamarin.Mac\Xamarin.Forms.Platform.macOS.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
@ -151,5 +154,5 @@
<BundleResource Include="Resources\hexlayout.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
<Import Project="..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.4.7.0.1351\build\Xamarin.Forms.targets')" />
<Import Project="..\packages\Xamarin.Forms.5.0.0.2125\build\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.5.0.0.2125\build\Xamarin.Forms.targets')" />
</Project>

Просмотреть файл

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="xamarinmac20" />
<package id="Xamarin.Essentials" version="1.3.1" targetFramework="xamarinmac20" />
<package id="Xamarin.Forms" version="4.7.0.1351" targetFramework="xamarinmac20" />
<package id="Xamarin.Essentials" version="1.7.0" targetFramework="xamarinmac20" />
<package id="Xamarin.Forms" version="5.0.0.2125" targetFramework="xamarinmac20" />
<package id="Xamarin.Forms.FontAwesome.Brand" version="1.0.0" targetFramework="xamarinmac20" />
<package id="Xamarin.Forms.IconFontHelper" version="1.0.0" targetFramework="xamarinmac20" />
</packages>

Просмотреть файл

@ -15,6 +15,7 @@
<Color x:Key="BackgroundColor">#F8F8F8</Color>
<!-- CONVERTERS -->
<converters:ColorToBrushConverter x:Key="ColorToBrushConverter" />
<converters:GalleryItemStatusToBoolConverter x:Key="GalleryItemStatusToBoolConverter" />
<converters:GalleryItemStatusToColorConverter x:Key="GalleryItemStatusToColorConverter" />
<converters:GalleryItemStatusToStringConverter x:Key="GalleryItemStatusToStringConverter" />

Просмотреть файл

@ -0,0 +1,23 @@
using System;
using System.Globalization;
using Xamarin.Forms;
namespace TemplateUI.Gallery.Converters
{
public class ColorToBrushConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is Color color)
return new SolidColorBrush(color);
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}

Просмотреть файл

@ -11,8 +11,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.7.0.1351" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2125" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
<PackageReference Include="Xamarin.Forms.FontAwesome.Brand" Version="1.0.0" />
</ItemGroup>

Просмотреть файл

@ -56,7 +56,7 @@
WidthRequest="48"
HorizontalOptions="Center"
VerticalOptions="Center"
Fill="{Binding Color}"/>
Fill="{Binding Color, Converter={StaticResource ColorToBrushConverter}}"/>
<Image
Aspect="AspectFit"
Source="{Binding Icon}"

Просмотреть файл

@ -97,8 +97,8 @@ namespace TemplateUI.DataVisualization
_areaChart = new Polygon
{
Aspect = Stretch.Fill,
Fill = Color,
Stroke = Color,
Fill = new SolidColorBrush(Color),
Stroke = new SolidColorBrush(Color),
StrokeThickness = 2
};
}
@ -119,8 +119,8 @@ namespace TemplateUI.DataVisualization
public override void UpdateColor()
{
_areaChart.Stroke = Color;
_areaChart.Fill = Color;
_areaChart.Stroke = new SolidColorBrush(Color);
_areaChart.Fill = new SolidColorBrush(Color);
}
void UpdateValueData()

Просмотреть файл

@ -111,8 +111,8 @@ namespace TemplateUI.DataVisualization
_barChart = new Path
{
Aspect = Stretch.Fill,
Stroke = Color,
Fill = Color,
Stroke = new SolidColorBrush(Color),
Fill = new SolidColorBrush(Color),
StrokeThickness = 1,
Margin = new Thickness(24, 0)
};
@ -136,8 +136,8 @@ namespace TemplateUI.DataVisualization
public override void UpdateColor()
{
_barChart.Stroke = Color;
_barChart.Fill = Color;
_barChart.Stroke = new SolidColorBrush(Color);
_barChart.Fill = new SolidColorBrush(Color);
}
void UpdateValueData()

Просмотреть файл

@ -120,7 +120,7 @@ namespace TemplateUI.DataVisualization
_valueTicks.Add(
new Line()
{
Stroke = Color.Black,
Stroke = new SolidColorBrush(Color.Black),
StrokeThickness = 1,
Y1 = 0,
Y2 = 4

Просмотреть файл

@ -96,7 +96,7 @@ namespace TemplateUI.DataVisualization
{
Aspect = Stretch.Fill,
Opacity = 0.25,
Stroke = Color.Gray,
Stroke = new SolidColorBrush(Color.Gray),
StrokeThickness = 1,
X1 = 0
};

Просмотреть файл

@ -116,7 +116,7 @@ namespace TemplateUI.DataVisualization
_valueTicks.Add(
new Line()
{
Stroke = Color.Black,
Stroke = new SolidColorBrush(Color.Black),
StrokeThickness = 1,
X1 = 0,
X2 = 4

Просмотреть файл

@ -98,7 +98,7 @@ namespace TemplateUI.DataVisualization
{
Aspect = Stretch.Fill,
WidthRequest = 100,
Stroke = Color,
Stroke = new SolidColorBrush(Color),
StrokeThickness = 2
};
}
@ -119,7 +119,7 @@ namespace TemplateUI.DataVisualization
public override void UpdateColor()
{
_lineChart.Stroke = Color;
_lineChart.Stroke = new SolidColorBrush(Color);
}
void UpdateValueData()

Просмотреть файл

@ -15,11 +15,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NuGetizer" Version="0.7.0">
<PackageReference Include="NuGetizer" Version="0.7.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Xamarin.Forms" Version="4.7.0.1351" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2125" />
</ItemGroup>
</Project>

Просмотреть файл

@ -21,7 +21,7 @@
<Ellipse
x:Name="Part_Border"
Aspect="Fill"
Stroke="{TemplateBinding BorderColor}"
Stroke="{TemplateBinding BorderColor, Converter={StaticResource ColorToBrushConverter}}"
StrokeThickness="{TemplateBinding BorderWidth}"
HorizontalOptions="Start"/>
<Label
@ -54,7 +54,7 @@
<Rectangle
x:Name="Part_Border"
Aspect="Fill"
Stroke="{TemplateBinding BorderColor}"
Stroke="{TemplateBinding BorderColor, Converter={StaticResource ColorToBrushConverter}}"
StrokeThickness="{TemplateBinding BorderWidth}"
HorizontalOptions="Start">
<Rectangle.RadiusX>

Просмотреть файл

@ -12,7 +12,7 @@
<Path
x:Name="PART_Tail"
Data="{StaticResource BubbleTailGeometry}"
Fill="{TemplateBinding BackgroundColor}"
Fill="{TemplateBinding BackgroundColor, Converter={StaticResource ColorToBrushConverter}}"
HorizontalOptions="End"
Aspect="Uniform"
VerticalOptions="End"
@ -46,7 +46,7 @@
<Path
x:Name="PART_Tail"
Data="{StaticResource BubbleTailGeometry}"
Fill="{TemplateBinding BackgroundColor}"
Fill="{TemplateBinding BackgroundColor, Converter={StaticResource ColorToBrushConverter}}"
HorizontalOptions="End"
Aspect="Uniform"
VerticalOptions="End"

Просмотреть файл

@ -25,7 +25,7 @@
WidthRequest="100"
HeightRequest="100"
HorizontalOptions="Start"
Stroke="{TemplateBinding ProgressColor}"
Stroke="{TemplateBinding ProgressColor, Converter={StaticResource ColorToBrushConverter}}"
StrokeThickness="4" />
<Grid
WidthRequest="100"

Просмотреть файл

@ -45,8 +45,8 @@
<Ellipse
HeightRequest="40"
WidthRequest="40"
Fill="{TemplateBinding BackgroundColor}"
Stroke="{TemplateBinding Color}"
Fill="{TemplateBinding BackgroundColor, Converter={StaticResource ColorToBrushConverter}}"
Stroke="{TemplateBinding Color, Converter={StaticResource ColorToBrushConverter}}"
StrokeThickness="4"
HorizontalOptions="Center"
VerticalOptions="Center"/>
@ -62,14 +62,14 @@
<Path
Aspect="Uniform"
Data="{StaticResource ArrowHeadLeftGeometry}"
Fill="{TemplateBinding Color}"
Stroke="{TemplateBinding Color}"/>
Fill="{TemplateBinding Color, Converter={StaticResource ColorToBrushConverter}}"
Stroke="{TemplateBinding Color, Converter={StaticResource ColorToBrushConverter}}"/>
<Path
Grid.Column="1"
Aspect="Uniform"
Data="{StaticResource ArrowHeadRightGeometry}"
Fill="{TemplateBinding Color}"
Stroke="{TemplateBinding Color}"/>
Fill="{TemplateBinding Color, Converter={StaticResource ColorToBrushConverter}}"
Stroke="{TemplateBinding Color, Converter={StaticResource ColorToBrushConverter}}"/>
</Grid>
</Grid>
</Grid>
@ -88,8 +88,8 @@
<Ellipse
HeightRequest="40"
WidthRequest="40"
Fill="{TemplateBinding BackgroundColor}"
Stroke="{TemplateBinding Color}"
Fill="{TemplateBinding BackgroundColor, Converter={StaticResource ColorToBrushConverter}}"
Stroke="{TemplateBinding Color, Converter={StaticResource ColorToBrushConverter}}"
StrokeThickness="4"
HorizontalOptions="Center"
VerticalOptions="Center"/>
@ -105,14 +105,14 @@
<Path
Aspect="Uniform"
Data="{StaticResource ArrowHeadUpGeometry}"
Fill="{TemplateBinding Color}"
Stroke="{TemplateBinding Color}"/>
Fill="{TemplateBinding Color, Converter={StaticResource ColorToBrushConverter}}"
Stroke="{TemplateBinding Color, Converter={StaticResource ColorToBrushConverter}}"/>
<Path
Grid.Row="1"
Aspect="Uniform"
Data="{StaticResource ArrowHeadDownGeometry}"
Fill="{TemplateBinding Color}"
Stroke="{TemplateBinding Color}"/>
Fill="{TemplateBinding Color, Converter={StaticResource ColorToBrushConverter}}"
Stroke="{TemplateBinding Color, Converter={StaticResource ColorToBrushConverter}}"/>
</Grid>
</Grid>
</Grid>

Просмотреть файл

@ -6,6 +6,7 @@
xmlns:controls="clr-namespace:TemplateUI.Controls">
<Color x:Key="GridSplitterIndicatorColor">#FF868686</Color>
<SolidColorBrush x:Key="GridSplitterIndicatorBrush" Color="{StaticResource GridSplitterIndicatorColor}" />
<controls:ElementToBoolConverter x:Key="ElementToBoolConverter" />
@ -29,11 +30,11 @@
IsVisible="{TemplateBinding Element, Converter={StaticResource ElementToBoolConverter}}">
<Line
X2="10"
Stroke="{StaticResource GridSplitterIndicatorColor}"
Stroke="{StaticResource GridSplitterIndicatorBrush}"
StrokeThickness="2" />
<Line
X2="10"
Stroke="{StaticResource GridSplitterIndicatorColor}"
Stroke="{StaticResource GridSplitterIndicatorBrush}"
StrokeThickness="2" />
</StackLayout>
</Grid>

Просмотреть файл

@ -17,8 +17,8 @@
WidthRequest="{Binding Source={x:Reference LayoutRoot}, Path=Width}"
HeightRequest="{Binding Source={x:Reference LayoutRoot}, Path=Height}"
Data="{TemplateBinding Icon}"
Fill="{TemplateBinding UnSelectedFill}"
Stroke="{TemplateBinding UnSelectedStroke}"
Fill="{TemplateBinding UnSelectedFill, Converter={StaticResource ColorToBrushConverter}}"
Stroke="{TemplateBinding UnSelectedStroke, Converter={StaticResource ColorToBrushConverter}}"
StrokeThickness="{TemplateBinding UnSelectedStrokeWidth}"
Aspect="Uniform"/>
<Grid
@ -29,8 +29,8 @@
WidthRequest="{Binding Source={x:Reference LayoutRoot}, Path=Width}"
HeightRequest="{Binding Source={x:Reference LayoutRoot}, Path=Height}"
Data="{TemplateBinding Icon}"
Fill="{TemplateBinding SelectedFill}"
Stroke="{TemplateBinding SelectedStroke}"
Fill="{TemplateBinding SelectedFill, Converter={StaticResource ColorToBrushConverter}}"
Stroke="{TemplateBinding SelectedStroke, Converter={StaticResource ColorToBrushConverter}}"
StrokeThickness="{TemplateBinding SelectedStrokeWidth}"
Aspect="Uniform"/>
</Grid>

Просмотреть файл

@ -47,7 +47,7 @@
WidthRequest="12"
HorizontalOptions="Center"
VerticalOptions="Center"
Fill="{TemplateBinding TextColor}"
Fill="{TemplateBinding TextColor, Converter={StaticResource ColorToBrushConverter}}"
Data="{StaticResource DeleteGeometry}"/>
</Grid>
</Grid>

Просмотреть файл

@ -20,15 +20,15 @@
HeightRequest="28"
WidthRequest="40"
Margin="2"
Fill="{TemplateBinding CurrentColor}"
Stroke="{TemplateBinding BorderColor}"
Fill="{TemplateBinding CurrentColor, Converter={StaticResource ColorToBrushConverter}}"
Stroke="{TemplateBinding BorderColor, Converter={StaticResource ColorToBrushConverter}}"
StrokeThickness="{TemplateBinding BorderWidth}"
RadiusY="{TemplateBinding CornerRadius}"
RadiusX="{TemplateBinding CornerRadius}"/>
<Ellipse
x:Name="PART_Thumb"
Fill="{TemplateBinding ThumbColor}"
Stroke="{TemplateBinding CurrentColor}"
Fill="{TemplateBinding ThumbColor, Converter={StaticResource ColorToBrushConverter}}"
Stroke="{TemplateBinding CurrentColor, Converter={StaticResource ColorToBrushConverter}}"
HorizontalOptions="Center"
VerticalOptions="Center"
HeightRequest="25"
@ -51,16 +51,16 @@
HeightRequest="24"
WidthRequest="44"
Margin="2"
Fill="{TemplateBinding CurrentColor}"
Stroke="{TemplateBinding BorderColor}"
Fill="{TemplateBinding CurrentColor, Converter={StaticResource ColorToBrushConverter}}"
Stroke="{TemplateBinding BorderColor, Converter={StaticResource ColorToBrushConverter}}"
StrokeThickness="{TemplateBinding BorderWidth}"
RadiusY="{TemplateBinding CornerRadius}"
RadiusX="{TemplateBinding CornerRadius}"/>
<Ellipse
x:Name="PART_Thumb"
Aspect="Uniform"
Fill="{TemplateBinding ThumbColor}"
Stroke="{TemplateBinding CurrentColor}"
Fill="{TemplateBinding ThumbColor, Converter={StaticResource ColorToBrushConverter}}"
Stroke="{TemplateBinding CurrentColor, Converter={StaticResource ColorToBrushConverter}}"
HorizontalOptions="Center"
VerticalOptions="Center"
HeightRequest="18"
@ -84,15 +84,15 @@
HeightRequest="14"
WidthRequest="40"
Margin="2"
Fill="{TemplateBinding CurrentColor}"
Stroke="{TemplateBinding BorderColor}"
Fill="{TemplateBinding CurrentColor, Converter={StaticResource ColorToBrushConverter}}"
Stroke="{TemplateBinding BorderColor, Converter={StaticResource ColorToBrushConverter}}"
StrokeThickness="{TemplateBinding BorderWidth}"
RadiusY="{TemplateBinding CornerRadius}"
RadiusX="{TemplateBinding CornerRadius}"/>
<Ellipse
x:Name="PART_Thumb"
Fill="{TemplateBinding ThumbColor}"
Stroke="{TemplateBinding CurrentColor}"
Fill="{TemplateBinding ThumbColor, Converter={StaticResource ColorToBrushConverter}}"
Stroke="{TemplateBinding CurrentColor, Converter={StaticResource ColorToBrushConverter}}"
HorizontalOptions="Center"
VerticalOptions="Center"
HeightRequest="25"

Просмотреть файл

@ -43,7 +43,7 @@
HeightRequest="12"
WidthRequest="12"
Data="{StaticResource ArrowHeadRightGeometry}"
Fill="{TemplateBinding CurrentTextColor}"
Fill="{TemplateBinding CurrentTextColor, Converter={StaticResource ColorToBrushConverter}}"
Margin="2, 6"/>
</Grid>
<Image