I have what I think is a very simple databinding question (I'm still new to WPF). I have a class (simplified for this question)
public class ConfigurationData
{
public int BaudRate { get; set; }
}
In MainWindow.Xaml.cs I have a private member variable:
private ConfigurationData m_data;
and a method
void DoStuff()
{
// do a bunch of stuff (read serial port?) which may result in calling...
m_data.BaudRate = 300; // or some other value depending on logic
}
In my MainWindow gui, I'd like to have a TextBox that displays m_data.BaudRate AND allows for two way binding. The user should be able to enter a value in the textbox, and the textbox should display new values that we're caused by "DoStuff()" method. I've seen tons of examples on binding to another property of a control on MainWindow, and binding to a datacollection, but no examples of binding to a property of another object. I would think that my example is about as simple as it get, with the nagging annoyance that I'm binding to an integer, not a string, and if possible, I would like the user to only be able to enter integers.
BTW I considered using a numeric up/down, but decided against it as there did not seem to be a lot of support/examples of non-commercial numeric up/down controls. Plus, it could be an awfully big range of numbers to spin through.
I think a pointer to one good example would get me on my way. Many thanks in advance, Dave