Maybe this is awfully wrong. I have a text box and want the value in that text box to be synchronized with a member of a class. I thought I use binding but I cannot get a handle on it. What I tried is below and does not work. Where am I thinking wrong?
Here is my XAML:
<Window x:Class="tt_WPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:tt_WPF"
Title="MainWindow" SizeToContent="WidthAndHeight">
<StackPanel>
<TextBox x:Name="tb" Width="200" Text="{Binding local:abc.Name}"></TextBox>
<Button Click="Button_Click">Ok</Button>
</StackPanel> </Window>
And here the code behind:
public class ABC
{
public string Name { get; set; }
}
public partial class MainWindow : Window
{
private ABC abc = new ABC();
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{ }
}