This is a bit of a noob question.
Basically, I have a grid MainGrid
in my WPF window
I'd simply like to be notified when the MainGrid
is resized ( when user maximizes/resizes the window).
This does nothing at the moment. Am I supposed to declare and then add this SizeChanged event earlier before it will work?
private void MainGrid_SizeChanged(object sender, SizeChangedEventArgs e)
{
MyTextBox.Text = "MainGrid resized";
}
Thank you
If you have your event in code-behind and this in XAML:
<Grid SizeChanged="MainGrid_SizeChanged">
it will work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.