dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.16k stars 1.74k forks source link

VisualState "Pressed" not supported on a "Border" control #13108

Closed coen22 closed 4 months ago

coen22 commented 1 year ago

Description

I would like to have the possibility to have the "Pressed" and "Released" states for controls other than the button. You could argue to use a button instead, but this control doesn't support child elements, which limits the use case. Currently, MAUI doesn't support native animations (e.g. ripple effect on Android). However, other options for animating are also limited compared to Xamarin Forms (where many of these features are implemented in the Xamarin Community Toolkit). Therefore, it would be great to make the VisualStates more flexible.

Public API Changes

The following options already work for Border or Frame controls:

<VisualState x:Name="PointerOver">
    <VisualState.Setters>
        <Setter Property="Opacity" Value="0.8" />
    </VisualState.Setters>
</VisualState>
<VisualState x:Name="Normal">
    <VisualState.Setters>
        <Setter Property="Opacity" Value="1" />
    </VisualState.Setters>
</VisualState>

This should become supported (or at least it's not working for me when I use this on a Border):

<VisualState x:Name="Pressed">
    <VisualState.Setters>
        <Setter Property="Opacity" Value="0.5" />
    </VisualState.Setters>
</VisualState>
<VisualState x:Name="Released">
    <VisualState.Setters>
        <Setter Property="Opacity" Value="1" />
    </VisualState.Setters>
</VisualState>

Intended Use-Case

In my app, I've got a FlexLayout with a collection of categories which are rendered using Borders which shows some of the profiles in the category. I would like to change the opacity or background colour if I press down on an item with a mouse button or touch event.

Screenshot 2023-02-03 at 16 41 52

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.