1
Answer

Stack overflow when recursing reference properties in a WPF Window

richard fencel

richard fencel

Jul 03
358
1

Can someone tell me why the following is legal when accessing an object of type WPF Window?

var win = new Window();
var x = win.Background.Transform.Inverse.Inverse.Inverse.Inverse.Inverse;  // ...goes on forever

I am trying to generate a recursive list of references for an object of type Window and when I get to Background.Transform.Inverse, I keep getting a pointer to another Inverse property.  This goes on forever and eventually I get a stack overflow error.  The value of Inverse is always {Identity}.

Thanks for any insight you can provide.

Answers (1)