I have a C# .NET 4.5 WPF application, with a public static class. Inside that class I have a public static string. What I want is very simple, I want to bind that static string to a WPF Label
, so whenever that string is updated, WPF Label will also get updated.
How can I achieve this with simplest and easiest way
Static class below
public static class GlobalStats
{
private static void updateValues()
{
srGlobalStatics="example";
}
public static string srGlobalStatics = "";
}
I want my WPF Label bound to that particular srGlobalStatics
string.
Here's my XAML code:
<Label Name="lblGlobalStats" Content="lblGlobalStats" HorizontalAlignment="Left"
Margin="10,36,0,0" VerticalAlignment="Top"/>
Isn't this possible ?
I can write a function inside MainWindow.xaml.cs however i don't want to put unnecessary code inside there as much as possible.