Xamarin.Forms
Xamarin.Forms copied to clipboard
[Bug] CSS inside ListView.Header doesn't work
Description
Steps to Reproduce
- Declare ListView.Header as StackLayout/Grid with Label and CSS style
- Declare CSS styles in .css file
Expected Behavior
CSS style will be applied
Actual Behavior
CSS style doesn't work
Basic Information
- Version with issue: 5.0.0.2515
- Last known good version:
- Platform Target Frameworks:
- iOS: 15.10.0.5
- Android: 12.3.3.3
- UWP:
- Android Support Library / AndroidX Version:
- NuGet Packages: Xamarin.Forms 5.0.0.2083+
- Affected Devices:
Environment
Show/Hide Visual Studio info
Visual Studio Community 2022 for Mac
Version 17.0.7 (build 7)
Installation UUID: 718c9426-9b34-4dad-a550-66605f1e5527
Runtime
.NET 6.0.5 (64-bit)
Architecture: X64
Roslyn (Language Service)
4.1.0-3.22075.3+592501cbb9c9394072a245c15b3458ff88155d85
NuGet
Version: 6.0.0.262
.NET SDK (x64)
SDK: /usr/local/share/dotnet/sdk/6.0.302/Sdks
SDK Versions:
6.0.302
6.0.301
6.0.300
6.0.202
6.0.201
6.0.106
6.0.103
6.0.102
6.0.101
6.0.100
5.0.408
5.0.407
5.0.406
5.0.405
5.0.404
5.0.403
5.0.402
5.0.401
5.0.400
5.0.302
5.0.301
5.0.203
5.0.202
5.0.201
5.0.103
5.0.102
5.0.101
5.0.100
3.1.421
3.1.420
3.1.419
3.1.418
3.1.417
3.1.416
3.1.415
3.1.414
3.1.413
3.1.412
3.1.411
3.1.410
3.1.409
3.1.408
3.1.407
3.1.406
3.1.405
3.1.404
3.1.403
3.1.402
3.1.401
3.1.302
3.1.301
3.1.300
3.1.202
3.1.200
3.1.102
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks
.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
6.0.7
6.0.6
6.0.5
6.0.4
6.0.3
6.0.2
6.0.1
6.0.0
5.0.17
5.0.16
5.0.15
5.0.14
5.0.13
5.0.12
5.0.11
5.0.10
5.0.9
5.0.8
5.0.7
5.0.6
5.0.5
5.0.4
5.0.3
5.0.2
5.0.1
5.0.0
3.1.27
3.1.26
3.1.25
3.1.24
3.1.23
3.1.22
3.1.21
3.1.20
3.1.19
3.1.18
3.1.17
3.1.16
3.1.15
3.1.14
3.1.13
3.1.12
3.1.11
3.1.10
3.1.9
3.1.8
3.1.7
3.1.6
3.1.5
3.1.4
3.1.2
2.1.23
2.1.22
2.1.21
2.1.20
2.1.19
2.1.18
2.1.17
2.1.16
Xamarin.Profiler
Version: 1.8.0.19
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Updater
Version: 11
Apple Developer Tools
Xcode 13.4.1 (20504)
Build 13F100
Xamarin.Mac
Version: 8.10.0.5 (Visual Studio Community)
Hash: 96b3edb6d
Branch: d17-2
Build date: 2022-05-18 07:32:06-0400
Xamarin.iOS
Version: 15.10.0.5 (Visual Studio Community)
Hash: 96b3edb6d
Branch: d17-2
Build date: 2022-05-18 07:32:07-0400
Xamarin Designer
Version: 17.1.5.90
Hash: 53f47efde
Branch: remotes/origin/d17-0-vsmac
Build date: 2022-07-20 22:42:31 UTC
Xamarin.Android
Version: 12.3.3.3 (Visual Studio Community)
Commit: xamarin-android/d17-2/4e061b7
Android SDK: /Users/yauhenipakala/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
12.1 (API level 32)
8.0 (API level 26)
6.0 (API level 23)
12.0 (API level 31)
8.1 (API level 27)
5.1 (API level 22)
11.0 (API level 30)
10.0 (API level 29)
7.1 (API level 25)
9.0 (API level 28)
7.0 (API level 24)
SDK Command-line Tools Version: 5.0
SDK Platform Tools Version: 33.0.2
SDK Build Tools Version: 33.0.0
Build Information:
Mono: dffa5ab
Java.Interop: xamarin/java.interop/d17-2@9760f0a9
ProGuard: Guardsquare/proguard/v7.0.1@912d149
SQLite: xamarin/sqlite/3.38.2@7b1e016
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-2@fc3c2ac
Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.12
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
Android SDK Manager
Version: 17.2.0.37
Hash: 7f5a6ef
Branch: remotes/origin/d17-2
Build date: 2022-07-20 22:42:36 UTC
Android Device Manager
Version: 0.0.0.1116
Hash: e47e6c8
Branch: remotes/origin/d17-2
Build date: 2022-07-20 22:42:36 UTC
Build Information
Release ID: 1700070007
Git revision: 5a924af5432fc0ed4adc294eb2edb6a95c97cf2e
Build date: 2022-07-20 22:40:26+00
Build branch: release-17.0
Build lane: release-17.0
Operating System
Mac OS X 12.4.0
Darwin 21.5.0 Darwin Kernel Version 21.5.0
Tue Apr 26 21:08:22 PDT 2022
root:xnu-8020.121.3~4/RELEASE_X86_64 x86_64
Reproduction Link
https://github.com/wcoder/ListViewHeaderCSSStylesBug
Workaround
Force and ugly refresh .Parent of the target element:
var temp = headerLabel.Parent;
headerLabel.Parent = listView;
headerLabel.Parent = temp;
to call internal ApplyStyleSheets():
https://github.com/xamarin/Xamarin.Forms/blob/94acebbb4bee16bf71338ef6906b308ca08524c2/Xamarin.Forms.Core/Element.cs#L353-L357