Does WPF also close all data bindings?

I just want to know if the data binding will respond to events with modified source code after the window is closed. And if so, how to free all data bindings.

All I can find on MSDN is the sentence for the Unloaded event: "When Unloaded is processed and processed, the element that is the parent of the event source (as defined by the Parent property) or any given element up in the logical or visual trees may already be not set, which means that data binding, resource references, and styles cannot be set to their normal or last known run-time value. "

But he says “can’t”, so I still don’t know what it will be or not. And he also says that the Unloaded event will not be raised if the application closes.

I found BindingOperation.ClearAllBindings (). But only one object seems obvious. To clear everything, do I have to recursively clear the visual tree or logical tree?

+5
source share
1 answer

It will be disabled as soon as the garbage collector clears the window.

You can see this behavior when manually deleting SqlConnections without closing them. As soon as the GC clears them, the connections close. Until then, you can speed up your connection pool.

0
source

All Articles