Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Please see the attached solution.
In App.xaml there are some implicit styles defined for ContentPage and Label types.
There are two options to run the app:
a) Use the conditional compilation symbol "XAML" for the portable project "StyleTest" to run the app using the Forms Xaml Page "StyledPage".
b) Remove the conditional compilation symbol "XAML" to run the app using a ContentPage that is programmatically assigned in App.xaml.cs' constructor.
You will see the following:
when using option a), the implicit background color style for the ContentPage is ignored.
when using option b), the implicit background color style for the ContentPage is respected.
The implicit styles for the Label type are always applied, no matter if using option a) or b).
Please fix so that implicit global styles are completely (i.e. for every supported type) applied when using Forms Xaml Pages.
Created attachment 9682 [details]
I have checked this issue with the help of sample app given in comment 1 and the steps provide in bug description, and able to reproduce the reported behaviour. Please refer the screencast :
Ide Log : https://gist.github.com/Udham1/e7e21bc8c66a089631a2
Simulator Log : https://gist.github.com/Udham1/2c77218b66358386616a
Note : I am getting the same behaviour with both Android and iOS app.
Environment Info :
Xamarin.Forms : 184.108.40.20621-pre2
=== Xamarin Studio ===
Version 5.7.1 (build 17)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
Mono 3.12.0 ((detached/a813491)
GTK+ 2.24.23 (Raleigh theme)
Package version: 312000068
=== Apple Developer Tools ===
Xcode 6.1.1 (6611)
=== Xamarin.iOS ===
Version: 220.127.116.11 (Business Edition)
Build date: 2015-01-31 17:42:21-0500
=== Xamarin.Android ===
Version: 18.104.22.168 (Business Edition)
Android SDK: /Users/xamarin76/Desktop/android-sdk-macosx
Supported Android versions:
1.6 (API level 4)
2.1 (API level 7)
2.2 (API level 8)
2.3 (API level 10)
3.1 (API level 12)
4.0 (API level 14)
4.0.3 (API level 15)
4.1 (API level 16)
4.2 (API level 17)
4.3 (API level 18)
4.4 (API level 19)
4.4.87 (API level 20)
5.0 (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
=== Xamarin.Mac ===
Version: 22.214.171.124 (Business Edition)
=== Build Information ===
Release ID: 507010017
Git revision: 0bc7d3550b6b088ac25b08dcf7bbe73bcc8658b3
Build date: 2015-02-03 19:43:29-05
Xamarin addins: f7b7d34419c9ec24501bfa7c658e80a6305613e0
=== Operating System ===
Mac OS X 10.9.5
Darwin Xamarin76s-Mac-mini.local 13.4.0 Darwin Kernel Version 13.4.0
Sun Aug 17 19:50:11 PDT 2014
An update to the above comment : Screencast http://www.screencast.com/t/cLWtToW0
This is how this is supposed to work. The TargetType must exactly match the type of the control you are styling. It does not match subclasses. This is to prevent any kind of surprises for other types/subclasses in your app and third party libraries.
@Jason: so if I got you right, you think it is not possible to declare an implicit BackgroundColor style for a ContentPage, because the BackgroundColor property is declared in VisualElement that's inherited by Page that's inherited by ContentPage?
But if so, why does the Label's implicit BackgroundColor style work?
And why should a subclass be a problem at all, as a subclass is always more concrete than the class it inherits from?
I cannot style the VisualElement's BackgroundColor property as this type is the base type for many subclasses.