Skip to content
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;
}
}
}
}
}
}
1 change: 1 addition & 0 deletions src/Controls/src/Xaml/Hosting/AppHostBuilderExtensions.cs
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