Bug 60442 - Style.Trigger does not work when wrote in app.xaml
Summary: Style.Trigger does not work when wrote in app.xaml
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.4.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-10-30 18:03 UTC by Julius Degutis
Modified: 2017-10-30 20:59 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Description Julius Degutis 2017-10-30 18:03:22 UTC
I want to set different FontFamily for different FontAttributes: one for None, another for Bold. I made Implicit style and put it in app.xaml, so it would work in whole application. And it does not work.
1. If I remove MergedWith="themes:LightThemeResources" from app.xaml - it works.

Is it a bug? Or intended behavior?

<Style TargetType="Label">
  <Trigger TargetType="Label" Property="FontAttributes" Value="None">
   <Setter Property="FontFamily" Value="{StaticResource MainFontFamily}" />
   <Setter Property="TextColor" Value="Red" />
   <Setter Property="BackgroundColor" Value="Yellow" />
  <Trigger TargetType="Label" Property="FontAttributes" Value="Bold">
   <Setter Property="FontFamily" Value="{StaticResource MainFontFamilyBold}" />
   <Setter Property="TextColor" Value="Blue" />
   <Setter Property="BackgroundColor" Value="Green" />
 <!--<Setter Property="FontFamily" Value="{StaticResource MainFontFamily}" />-->
 <!--<Setter Property="TextColor" Value="#00B6F0" />-->
Comment 1 Paul DiPietro [MSFT] 2017-10-30 20:52:22 UTC
Per these docs: https://developer.xamarin.com/guides/xamarin-forms/xaml/resource-dictionaries/#Merged_Resource_Dictionaries

"The ResourceDictionary specified as the value of the MergedWith property is merged into the current ResourceDictionary instance. Note that any resources in the current ResourceDictionary that share x:Key attribute values with resources in the ResourceDictionary to be merged, will be replaced."
Comment 2 Julius Degutis 2017-10-30 20:59:34 UTC
That would mean that whole style won't be set? As in my case if I uncomment bottom setters, they are working, but not the Style.Trigger. Or that means that LightThemeResources contains trigger for FontAttributes and mine are replaced?