question

JohnOstler-6145 avatar image
0 Votes"
JohnOstler-6145 asked Nandhagopal edited

trying to get the size changed even of a stack panel but it doesn't recognise it

Hello all I am trying to get the size changed event of a stack panel like this but its not working and i cant figure out or research why this is.

this.stackPanel1.SizeChanged += new SizeChangedEventHandler(myRectangleSizeChangedEvent);

private void myRectangleSizeChangedEvent(object sender, System.EventArgs e)
{
MessageBox.Show("Rectangle changed!");
Canvas.SetLeft(this.quickExit1, this.stackPanel1.Width - 32);


     }







Please let me know anyone if you have and tip thanks alot.




not-supporteddotnet-runtime
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ajachocki avatar image
0 Votes"
ajachocki answered

Actually you won't be able to track OnSizeChange, as it has direct routing strategy. So only the control can use it. What you might be interested in is using ObservableCollection of items rendered in your stack panel. ObservableCollection has event that will tell you if any item has been removed or added. You might also check whole Window size or just stack panel's parent.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.