Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwipeView shows what's beneath while still swiping - fix #22741

Merged
merged 2 commits into from
Jun 12, 2024
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
39 changes: 39 additions & 0 deletions src/Controls/src/Core/SwipeView/SwipeView.Mapper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using Microsoft.Maui.Controls.Compatibility;

namespace Microsoft.Maui.Controls
{
public partial class SwipeView
{
[Obsolete("Use SwipeViewHandler.Mapper instead.")]
internal static IPropertyMapper<ISwipeView, ISwipeViewHandler> ControlsSwipeMapper =
new ControlsMapper<SwipeView, SwipeViewHandler>(SwipeViewHandler.Mapper);

internal static new void RemapForControls()
{
// Adjusted the mapping to preserve SwipeView.Entry legacy behavior
SwipeViewHandler.Mapper.AppendToMapping<SwipeView, ISwipeViewHandler>(nameof(Background), MapBackground);
}

static void MapBackground(ISwipeViewHandler handler, SwipeView swipeView)
{
if (swipeView.Content is not null)
{
var contentBackgroundIsNull = Brush.IsNullOrEmpty(swipeView.Content.Background);
var contentBackgroundColorIsNull = swipeView.Content.BackgroundColor == null;

if (contentBackgroundIsNull && contentBackgroundColorIsNull)
{
if (!Brush.IsNullOrEmpty(swipeView.Background))
{
swipeView.Content.Background = swipeView.Background;
}
else if (swipeView.BackgroundColor != null)
{
swipeView.Content.BackgroundColor = swipeView.BackgroundColor;
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ internal static MauiAppBuilder RemapForControls(this MauiAppBuilder builder)
Window.RemapForControls();
Editor.RemapForControls();
Entry.RemapForControls();
SwipeView.RemapForControls();
Picker.RemapForControls();
SearchBar.RemapForControls();
TabbedPage.RemapForControls();
Expand Down
Loading