Binding text via a function
<p>I am developing an app using Xamarin, and currently trying to display the screen width to the (I later plan to base sizes of certain objects off this)</p>

<p>I am attempting to use bindings to do this, but unfortunately it doesn't appear to work as expected. It does not throw an exception, just the label that I am attempting to bind has no text value.</p>

<p>I am sure I will be using bindings quite a lot during the rest of the project, so I would be greatly appreciative of any advice.</p>

<p>Please consider the following code:</p>

<p>C#:</p>

<pre><code>using Xamarin.Forms;
using XLabs.Ioc;
using XLabs.Platform.Device;

namespace TimerStyles
{
    public partial class SavedTimesPage : ContentPage
    {
        string screenWidthText = "";

        public SavedTimesPage()
        {
            InitializeComponent();
            this.screenWidth = getScreenWidth();
        }

        public string screenWidth
        {
            protected set
            {
                screenWidthText = value;
            }
            get { return screenWidthText; }
        }

        public string getScreenWidth()
        {
            var dev = Resolver.Resolve&lt;IDevice&gt;();
            var display = dev.Display;
            double ScreenWidthInches = (double)display.Width / display.Xdpi;
            var ScreenWidth = (ScreenWidthInches.ToString());

            return ScreenWidth;
        }

        public string getScreenHeight()
        {
            var dev = Resolver.Resolve&lt;IDevice&gt;();
            var display = dev.Display;
            double ScreenHeightInches = (double)display.Height / display.Ydpi;
            var ScreenHeight = (ScreenHeightInches.ToString());

            return ScreenHeight;
        }
    }
}
</code></pre>

<p>Xaml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:TimerStyles="clr-namespace:TimerStyles;assembly=TimerStyles"
             x:Class="TimerStyles.SavedTimesPage"
             NavigationPage.HasNavigationBar="false"&gt;

  &lt;ContentPage.Content&gt;  
    &lt;StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="#232224"&gt;
      &lt;Label Text="x" TextColor="Blue" FontSize="Large"/&gt;
      &lt;Label Text="{Binding screenWidth}" TextColor="Blue" FontSize="Large"/&gt;
      &lt;Label Text="x" TextColor="Blue" FontSize="Large"/&gt;

    &lt;/StackLayout&gt;   
  &lt;/ContentPage.Content&gt; 

&lt;/ContentPage&gt;
</code></pre>