Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would create a <strong>public</strong> property to hold the text field and implement <a href="http://msdn.microsoft.com/en-us/library/ms743695.aspx" rel="nofollow noreferrer">INotifyPropertyChanged</a>. You can easily <a href="http://msdn.microsoft.com/en-us/library/ms750612.aspx" rel="nofollow noreferrer">bind</a> the TextBlock to the property in the xaml file.</p> <pre><code>&lt;TextBlock Text="{Binding Path=StatusText}"/&gt; </code></pre> <p>Then you just change the property and the UI will always be up to date.</p> <p>In my work projects at the moment, the class representing the Window only contains method handlers, which call the public interface of a ViewModel/Presenter class. The ViewModel contains anything the UI needs to bind to and launches any and all functions by adding jobs to the ThreadPool.</p> <p>Of course, all my projects at the moment involve batch processing so letting the ThreadPool deal with concurrency issues makes sense in my case.</p> <p><strong>Update:</strong> Can you try the properties approach again but making sure the property is public. According to <a href="http://msdn.microsoft.com/en-us/magazine/cc163299.aspx" rel="nofollow noreferrer">this page</a>, you can only bind to public properties.</p> <pre><code>Imports System.ComponentModel Partial Public Class Window1 Implements INotifyPropertyChanged Private _StatusText As String = String.Empty Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged // I think the property has to be public for binding to work Public Property StatusText() As String Get Return _StatusText End Get Set(ByVal value As String) _StatusText = value OnPropertyChanged("StatusText") End Set End Property Shadows Sub OnPropertyChanged(ByVal name As String) RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(name)) End Sub ... Sub Load() ... Cursor = Cursors.Wait StatusText = "Loading..." System.Threading.Thread.Sleep(New TimeSpan(0, 0, 3)) StatusText = String.Empty Cursor = Cursors.Arrow ... End Sub </code></pre> <p>...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload