View.Xaml.cs
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window,INotifyPropertyChanged
{
private string textdisplayed;
public string Textdisplayed
{
get { return textdisplayed; }
set
{
textdisplayed = value;
InvokePropertyChanged(new PropertyChangedEventArgs("Textdisplayed"));
}
}
#region Implementation of INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
public void InvokePropertyChanged(PropertyChangedEventArgs e)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null) handler(this, e);
}
#endregion
}
Измените текст там, где вам нужно. Просто привяжите свойство Textdispalyed
к вашей метке в XAML правильно ..
View.Xaml
<TextBlock Text="{Binding Path=Textdisplayed,
ElementName=mainWindow}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="36"></TextBlock>