Answer the question
In order to leave comments, you need to log in
How to change the contents of a Label inside a Page using Window buttons?
Given:
1. A window with the MainWindow class
2. Inside the window there is a Frame element that is responsible for rendering the necessary page (for example, AboutPage), and there are also two buttons
- the first ShowPageButton is responsible for rendering the Page (roughly performs Frame.Content = new AboutPage())
- the second ChangeLabelButton is responsible for changing the Label (performs, roughly, TestText.Content = "Some test
text
"
)
change the contents of the TestText by clicking on the ChangeLabelButton button?
Answer the question
In order to leave comments, you need to log in
Everything turned out to be simple:
private void ChangeLabelButton_Click(object sender, RoutedEventArgs e) {
// ... другой выполняемый код
Frame.Refresh();
// ... другой выполняемый код
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question