I am using wpf. I want to bind a textbox with a simple string type value initialized in xaml.cs class. The TextBox
isn't showing anything. Here is my XAML code:
<TextBox Grid.Column="1" Width="387" HorizontalAlignment="Left" Grid.ColumnSpan="2" Text="{Binding Path=Name2}"/>
And the C# code is this:
public partial class EntitiesView : UserControl
{
private string _name2;
public string Name2
{
get { return _name2; }
set { _name2 = "abcdef"; }
}
public EntitiesView()
{
InitializeComponent();
}
}