Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Rename TouchEffect VisualState from Normal to Unpressed for avoiding naming conflict #1056

Merged
merged 5 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion samples/XCT.Sample/Pages/Effects/TouchEffectPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
<StackLayout Style="{StaticResource GridRowContentStyle}">
<Label Text="Image | Native" />
<Image Source="{xct:ImageResource Id=Xamarin.CommunityToolkit.Sample.Images.button.png}"
xct:TouchEffect.NativeAnimation="True" />
xct:TouchEffect.NativeAnimation="True"
xct:TouchEffect.Command="{Binding Command, Source={x:Reference Page}}"/>
</StackLayout>
</StackLayout>
</ScrollView>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ void UpdateStatusAndState(TouchEffect sender, TouchStatus status, TouchState sta
void UpdateVisualState(VisualElement visualElement, TouchState touchState, HoverState hoverState)
{
var state = touchState == TouchState.Pressed
? nameof(TouchState.Pressed)
? TouchEffect.PressedVisualState
: hoverState == HoverState.Hovered
? nameof(HoverState.Hovered)
: nameof(TouchState.Normal);
? TouchEffect.HoveredVisualState
: TouchEffect.UnpressedVisualState;

VisualStateManager.GoToState(visualElement, state);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ namespace Xamarin.CommunityToolkit.Effects
{
public class TouchEffect : RoutingEffect
{
public const string UnpressedVisualState = "Unpressed";

public const string PressedVisualState = "Pressed";

public const string HoveredVisualState = "Hovered";

public event EventHandler<TouchStatusChangedEventArgs> StatusChanged
{
add => weakEventManager.AddEventHandler(value);
Expand Down