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

[macOS] Fix transparent ListView background #6050

Merged
merged 2 commits into from May 11, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,31 @@
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

#if UITEST
using Xamarin.Forms.Core.UITests;
using Xamarin.UITest;
using NUnit.Framework;
#endif

namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.ManualReview)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 6021, "[macOS] ListView does not handle transparent backgrounds correctly", PlatformAffected.macOS)]
public class Github6201 : TestContentPage // or TestMasterDetailPage, etc ...
{
protected override void Init()
{
BackgroundColor = Color.Red;

Content = new ListView
{
Margin = new Thickness(20),
BackgroundColor = Color.FromRgba(0, 0, 1, 0.5),
ItemsSource = new string[] { "Page background should be red", "ListView background should be blue with 50% alpha and so should appear purple", "[iOS, macOS] Default behavior is to make cells have the same color as the ListView, so the cells should appear 100% blue", "[Other platforms] Cells should be transparent, and appear purple", "If the cells appear pale blue, then the ListView has an extra white background", "If the cells appear dark blue, then the cells have the same blue with 50% alpha as a background", "If the ListView appears dark blue, then background colors with alpha is not supported" },
};
}
}
}
Expand Up @@ -945,6 +945,7 @@
<DependentUpon>Issue4356.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Issue5951.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Github6021.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue5132.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion Xamarin.Forms.Platform.MacOS/Renderers/ListViewRenderer.cs
Expand Up @@ -131,7 +131,8 @@ protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
{
AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable,
DocumentView = _table = CreateNSTableView(e.NewElement),
HasVerticalScroller = true
HasVerticalScroller = true,
DrawsBackground = false,
};
SetNativeControl(scroller);
}
Expand Down