1
votes

This is a bit of a noob question.

Basically, I have a grid MainGridin my WPF window

I'd simply like to be notified when the MainGridis 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

1
ohhhhhhhhhh :) Yes it worked! I feel like fred flintstone . - iAteABug_And_iLiked_it

1 Answers

4
votes

If you have your event in code-behind and this in XAML:

<Grid SizeChanged="MainGrid_SizeChanged">

it will work.