Bug 33666 - Label.Text change reset the TextView.TypeFace property
Summary: Label.Text change reset the TextView.TypeFace property
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 1.4.4
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-09-04 12:35 UTC by Maria
Modified: 2016-01-20 13:10 UTC (History)
1 user (show)

Tags:
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 Maria 2015-09-04 12:35:17 UTC
Every time after Label.Text changed, the font is changing to standard (when it was previously set to custom in LabelRenderer, using TypeFace Property).
Comment 1 Stephane Delcroix 2016-01-20 13:10:50 UTC
Hi Maria,

If I understand this well, you're doing a custom renderer based on android's LabelRenderer, and at some point you set the TypeFace directly in the renderer to something of your own.

In the current LabelRenderer, every time the Text, FormattedText, Font or TextColor is changed, we reset all the properties. It's a choice we had to make to support some special scenarios and fix bugs on some android versions. As such, it doesn't qualify as a bug.

You can workaround this easily in your renderer, by overriding OnElementPropertyChanged:

	protected override void OnElementPropertyChanged (object sender, PropertyChangedEventArgs e)
	{
		base.OnElementPropertyChanged (sender, e);

		if (e.PropertyName == Label.TextColorProperty.PropertyName)
			SetTypeFace ();
		else if (e.PropertyName == Label.FontProperty.PropertyName)
			SetTypeFace ();
		else if (e.PropertyName == Label.TextProperty.PropertyName || e.PropertyName == Label.FormattedTextProperty.PropertyName)
			SetTypeFace ();
	}