Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Bind label.FontAttributesProperty

$
0
0

Hi all,

I have a listview with an item source being a list of the following class:

public class AllMessages
{
    public DateTime RecivedDate {get; set;}
    public string from {get;set;}
    public string subject {get;set;}
    public bool status { get; set;}
    public int id {get;set;}
    public string FontAttributesProperty  { get{
            if (status) {
                return "FontAttributes.None";
                } else {
                return "FontAttributes.Bold";
                }
            } set {
            FontAttributesProperty = value;
            }
    }
}

I customised my list view and how it is displayed and I want the text to change depending if the message has been read or not. So i tried the code below.

        Label fromLabel = new Label ();
        fromLabel.SetBinding (Label.TextProperty, "from");
        fromLabel.SetBinding (Label.FontProperty, "FontAttributesProperty");
        Label titlelable = new Label ();
        titlelable.SetBinding (Label.TextProperty, "subject");
        titlelable.SetBinding (Label.FontAttributesProperty, "FontAttributesProperty");

the text property gets blinded correctly and the text displays the correct characters, however the font doesn't get bold when the message is not read, do you guys know a way to actually bind the font attributes property of a label ? because it seems like is doing nothing.

Thanks!


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>