For some reason I'm really struggling with this. I'm new to wpf and I can't seem to find the information I need to understand this simple problem.
I am trying to bind a textbox to a string, the output of the programs activity. I created a property for the string, but when the property changes, the textbox does not. I had this problem with a listview, but created a dispatcher which refreshes the listview.
I must be missing some major point, because I thought one benefit of using wpf was not having to update controls manually. I hope someone can send me in the right direction.
in windowMain.xaml.cs
private string debugLogText = "initial value";
public String debugLog {
get { return debugLogText; }
set { debugLogText = value; }
}
in windowMain.xaml
x:Name="wndowMain"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
<TextBox Name="txtDebug" Text="{Binding ElementName=wndowMain, Path=debugLog}" />