How can I bind a Label in XAML to a public const string in Code Behind using Xamarin.Forms?
Or is there no other way than to create a public static Property that is accessing my public Constant? Which by the way then could be made a private const string instead.
I'm declaring a public const string in my "App" class:
public partial class App : Application
{
public const string ShortVersion = "v1.00 Beta 1";
...
Then I want to bind it to a label in my "MainPage.xaml" file:
<Label Text="{Binding App.ShortVersion}"
x:Name="_versionLabel" Style="{StaticResource versionLabel}" ...
/>
It's my first time trying databinding.
Right now I'm doing this (instead of databinding) in my "MainPage.xaml.cs" file:
public MainPage()
{
InitializeComponent();
_versionLabel.Text = App.ShortVersion;
}