I have a MainWindow that contains a [statusTextblock] text block that has a binding to the [StatusText] line. StatusTextblock should display combobox results from another window. I pass this data back to mainwindow when it changes in another window, and I made a static method to change the line when this happens.
However, the static nature of all this does not allow me to change my text field element at any time to a new StatusText value.
I was thinking of working around to make changes when the user returned to Mainwindow, but I failed. I tried activating the getfocus and uielement event handler (I feel the second is still a possible fix).
Mainwindow is also always open, if that matters. I also prefer to do something in the code than xaml, but would be grateful for any help.
Any ideas?
MainWindow xaml, then the program input method, then a static event to change statusText
<TextBlock Margin="190,0,0,0" HorizontalAlignment="Right" Name="StatusTextBlock" Text= {Binding}" ></TextBlock> public MainWindow() //Obviously more went here, but it not relevent { StatusTextBlock.DataContext = statusText; } static public void changeStatusText(string status) { statusText = status; }
source share