[RnD]: Adaptive-Properties.MAUI #118
Labels
android📱
Related to android
community 🤝
Controls or libraries that came from github community
level/normal 🙂
In comfort zone, little research and may require using built-in features, but no RnD
new feature 🚀
New feature addition
on-hold 💤
Blocked !!!!
windows 💻
Related to windows platform
Milestone
Description
Original source
https://github.com/rudyspano/MAUI-Adaptive-Properties
Adaptive-Properties.MAUI
XAML is powerful! It allows to describe complex UI and a lot of mechanisms provide solutions to add dynamism: Triggers (DataTrigger, Adaptive Triggers), Visual States, Attached Properties, Behaviors, ...
However, out of the box, you have to write a lot of code in order to adapt UI depending on the running form factor, orientation or state: Phones, Tablets, Foldable Phones, Vertical/Horizontal orientation, ...
The goal of this library is to provide a simple way to develop and maintain UI that handles this complexity.
Example:
The following XAML defines a part of UI with a Phone First Approach and overrides properties for Tablet (or foldable phone in the opened state) (m:T.XX, m:TV.XX, m.TH.XX)
Different Modes
You can use the following modes in order to override properties:
About Custom mode
If you need to handle other modes based on another state (depending on accessibility for example), you can override properties by using m:X.{PropertyName}, m:X2.{PropertyName}, m:X3.{PropertyName}.
In order to define conditions and trigger a custom mode, you have to use the 2 following methods:
See more in the sample here: https://github.com/rudyspano/MAUI-Adaptive-Properties/tree/main/sources/AdaptiveProperties.Demo/Views/3-CustomMode
Properties
A lot but not all properties of MAUI are available.
You can easily see which ones in the definition class here: https://github.com/rudyspano/MAUI-Adaptive-Properties/blob/main/sources/AdaptiveProperties.Configuration/Code.Configuration.cs
Remarks & Limitations
The real benefit of this Library depends, of course, of your needs. It is really efficient if the amount of adapations is reasonable => if a lot of adaptations are required, you should probably create specific views.
If your adaptations are mainly based on colors, fontSize (...) and do not concern layout properties, you should simply use Theming out-of-the-box features: https://learn.microsoft.com/en-us/dotnet/maui/user-interface/theming?view=net-maui-7.0
For the moment, properties does'nt handle DataBinding with value tracking and it's not really a goal considering efficient existing mechanisms.
If this project interests you, please share or contribute :)
Public API Changes
Intended Use-Case
The goal of this library is to provide a simple way to develop and maintain UI that handles this complexity.
The text was updated successfully, but these errors were encountered: