Plugin.Maui.Rotatable
1.0.1
dotnet add package Plugin.Maui.Rotatable --version 1.0.1
NuGet\Install-Package Plugin.Maui.Rotatable -Version 1.0.1
<PackageReference Include="Plugin.Maui.Rotatable" Version="1.0.1" />
paket add Plugin.Maui.Rotatable --version 1.0.1
#r "nuget: Plugin.Maui.Rotatable, 1.0.1"
// Install Plugin.Maui.Rotatable as a Cake Addin #addin nuget:?package=Plugin.Maui.Rotatable&version=1.0.1 // Install Plugin.Maui.Rotatable as a Cake Tool #tool nuget:?package=Plugin.Maui.Rotatable&version=1.0.1
Plugin.Maui.Rotatable
Plugin.Maui.Rotatable
provides the ability to customize your presentation when the orientation changes inside a .NET MAUI application.
Install Plugin
Available on NuGet.
Install with the dotnet CLI: dotnet add package Plugin.Maui.Rotatable
, or through the NuGet Package Manager in Visual Studio.
Supported Platforms
Platform | Minimum Version Supported |
---|---|
iOS | 11+ |
macOS | 10.15+ |
Android | 5.0 (API 21) |
Windows | 11 and 10 version 1809+ |
API Usage
Plugin.Maui.Rotatable
provides the RotatableImplementation
class that has a single property IsPortrait
that you can get.
You can use it as a base class, e.g.: {Binding IsPortrait}
Straight usage
You can enable your classes to depend on RotatableImplementation
as per the following example.
public class RotatableViewModel : RotatableImplementation
{
}
Then you can use property IsPortrait
in your presentation as per the following example.
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="MyAwesomeApp.MainPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:c="clr-namespace:MyAwesomeApp.Converters"
xmlns:vm="clr-namespace:MyAwesomeApp.ViewModels">
<ContentPage.BindingContext>
<vm:MainPage />
</ContentPage.BindingContext>
<Grid ColumnDefinitions="*,2*,*" ColumnSpacing="0">
<Grid Padding="10" BackgroundColor="Red">
<Grid.Column>
<Binding Path="IsPortrait">
<Binding.Converter>
<c:RotatableColumnConverter x:TypeArguments="x:Int32" />
</Binding.Converter>
</Binding>
</Grid.Column>
<Grid.ColumnSpan>
<Binding Path="IsPortrait">
<Binding.Converter>
<c:RotatableColumnSpanConverter x:TypeArguments="x:Int32" />
</Binding.Converter>
</Binding>
</Grid.ColumnSpan>
<Label
FontSize="Medium"
HorizontalTextAlignment="Center"
Text="I am customized for every orientation"
TextColor="White"
VerticalTextAlignment="Center" />
</Grid>
</Grid>
</ContentPage>
Rotatable
Once you have overridden a RotatableImplementation
you can interact with it in the following ways:
Properties
IsPortrait
Gets a value indicating whether the orientation is changed.
Functions
InvokeProperty(string? propertyName)
Sends an event when a property is changed.
Acknowledgements
This project could not have came to be without these projects and people, thank you! ❤️
Plugin.Maui.Feature template
Basically the template for this plugin. We have been using this in our .NET MAUI projects with much joy and ease, so thank you so much Gerald (and contributors!) for that. Find the original project here where we have based our project on and evolved it from there.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-android34.0 is compatible. net8.0-browser was computed. net8.0-ios was computed. net8.0-ios17.5 is compatible. net8.0-maccatalyst was computed. net8.0-maccatalyst17.5 is compatible. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net8.0-windows10.0.19041 is compatible. |
-
net8.0
- Microsoft.Maui.Controls (>= 8.0.72)
-
net8.0-android34.0
- Microsoft.Maui.Controls (>= 8.0.72)
-
net8.0-ios17.5
- Microsoft.Maui.Controls (>= 8.0.72)
-
net8.0-maccatalyst17.5
- Microsoft.Maui.Controls (>= 8.0.72)
-
net8.0-windows10.0.19041
- Microsoft.Maui.Controls (>= 8.0.72)
- System.Management (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Added functio to interface