-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Enhancement] AdaptiveTriggers #9422
Conversation
{ | ||
var weakEvent = new WeakEventListener<OrientationStateTrigger, object, EventArgs>(this) | ||
{ | ||
OnEventAction = (instance, source, eventArgs) => OnSizeChanged(source, eventArgs), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DeviceInfo implements INPC so you can just subscribe to that and watch for Orientation changes
...Forms.Controls/GalleryPages/VisualStateManagerGalleries/StateTriggersDirectlyOnElements.xaml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some Core.UnitTests as well?
@PureWeen I have added some unit tests. |
5163fd3
to
2c7c181
Compare
Thank you for making IsActive a public getter instead of protected. I'd like to propose you also add an event for when it changes. The reason for that is to be able to make composite state triggers. I state my case for that in this design issue: |
Thanks for the feedback @dotMorten. I think one of the most interesting things related to StateTriggers is the possibility of creating new ones and your proposal is interesting because it is simple but enables new options. |
84c4d7c
to
ed2186e
Compare
Description of Change
An AdaptiveTrigger provides an easy way to set the threshold (also called 'breakpoint') where a state is applied. A VisualState defines property values that are applied to an element when it’s in a particular state. You group visual states in a VisualStateManager that applies the appropriate VisualState when the specified conditions are met.
Example:
Issues Resolved
API Changes
Added:
In Xamarin.Forms.DualScreen:
Platforms Affected
Behavioral/Visual Changes
None
Before/After Screenshots
AdaptiveTrigger

DeviceStateTrigger
Running on Android

Running on iOS

OrientationStateTrigger
CompareStateTrigger
DualScreenStateTrigger
Testing Procedure
Launch Core Gallery and navigate to the VisualStateManager samples. Here, can find new samples related with Adaptive Triggers.
PR Checklist