Bug 51631

Summary: Effect doesn't work with binding
Product: Forms Reporter: AlexvanB <alexandravanbrouwershaven>
Component: FormsAssignee: Stephane Delcroix <stephane.delcroix>
Severity: normal CC: chris.king, jas, rui.marinho, sahou, stephane.delcroix
Priority: Normal    
Version: 2.3.4   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS   
Tags: AC ios Is this bug a regression?: ---
Last known good build:
Attachments: Testcase

Description AlexvanB 2017-01-19 07:07:47 UTC
Because we have our own fonts and accessibility sizing I made effects to render label text, this works for hard coded text but not for text injected via binding.

        <Label Text="Title" Style="{StaticResource BodyTextStyle}" >
                <local:BodyStyleFontEffect />

Does not work
        <Label Text="{Binding Title}" Style="{StaticResource BodyTextStyle}" >
                <local:BodyStyleFontEffect />
Comment 1 AlexvanB 2017-01-19 09:07:04 UTC
Workaround, in the effect force the property changed 

protected override void OnAttached ()
        var preferredFont = UIFont.GetPreferredFontForTextStyle (new NSString (Constants.FontBodyIOS));
        var fontname = UIAccessibility.IsBoldTextEnabled ? Constants.FontBold : Constants.FontRegular;

        if (Element is Label) {
            var label = Control as UILabel;
            label.Font = UIFont.FromName (fontname, preferredFont.PointSize);

            Element.PropertyChanged += (sender, e) => {
                label.Font = UIFont.FromName (fontname, preferredFont.PointSize);
Comment 2 Stephane Delcroix 2017-01-27 11:30:45 UTC
Could you please attach the simplest possible project triggering this issue so we could investigate ?

Comment 3 AlexvanB 2017-02-01 09:25:24 UTC
Created attachment 19676 [details]
Comment 4 Stephane Delcroix 2017-02-01 11:56:31 UTC
Comment 5 Stephane Delcroix 2017-05-31 09:28:50 UTC
it's not related to Binding, but to timing. changing the Label.Text after a short delay produce the same behavior.
Comment 6 Stephane Delcroix 2017-05-31 09:33:38 UTC
found it.

updating the Text resets text color and font.

Comment 7 Samantha Houts [MSFT] 2017-06-08 17:12:48 UTC
Comment 8 Rui Marinho 2017-06-22 09:52:50 UTC
Should be fixed on 2.3.6-pre1