I am attempting to bind a TextBlock's text to a string variable located in a instanced class that comes from a separate library (DLL), but I am new to WPF and it's binding model so I'm not quite sure how this is done or if it is possible. I'd like to stay away from setting the text in codebehind as I like the idea of the binding model better.
(Example of the class) From a separate library:
public class LoggedInUser
{
public string Username { get; }
}
And then elsewhere in the program:
public static LoggedInUser MyUser;
So basically,
<TextBlock Text="{Binding MyUser.Username}" />
Where MyUser is an instanced class stored elsewhere in the program.
This is what I am essentially trying to do: Simply bind TextBlock's text to a string that is in an instance of a class that comes from a separate library and the instance of the class is stored in my program elsewhere.
Anyone have any ideas? Would the text change when the value changes?
Thank you.