Bug 31526 - LabelRenderer sets Font for too many different other properties
Summary: LabelRenderer sets Font for too many different other properties
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.3
Hardware: All All
: --- minor
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-01 03:04 UTC by david
Modified: 2016-04-10 03:41 UTC (History)
4 users (show)

Tags: AC
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:
Status:
RESOLVED ANSWERED

Description david 2015-07-01 03:04:31 UTC
I just wrote a custom renderer for Label on Xamarin Forms. This is needed because the default implementation can't use Custom Fonts, per the information here: http://blog.xamarin.com/custom-fonts-in-ios/ and here: http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/fonts/#Using_a_Custom_Font.

However, it's not sufficient to merely set the font on the Control property of the custom renderer, because this gets reset by the base renderer when several other properties change:

Font
FontFamily
Text
TextColor
FormattedText

The processor for each of these properties also sets the font of the Control, which overwrites the customisation I put into my LabelRenderer subclass. It also means as a point of design that the Xamarin.Forms abstraction is very leaky, because to correctly implement a font-setter override you have to know about all the other property updates that also set the font.

Please make each property change only update the specific part of the underlying object that it is really concerned with.
Comment 1 Jason Smith [MSFT] 2016-04-10 03:41:35 UTC
This change will be made as soon as we can remove the deprecated API and no longer need to support it.