I need to access a WPF usercontrol's designheight and designwidth at runtime. I know this is impossible, so I'll explain why I want to do it, and hopefully someone can provide an example of the right approach.
From a C# winforms app, I open a new window containing a very large WPF usercontrol. If the monitor I'm running on can handle it, I want it to open the window at the full design size of the usercontrol. If the monitor I'm running on can't handle it, then I want to open the window as large as possible, leaving 1 pixel on each side of the screen. So I need to know the usercontrol's current design width and height before the usercontrol is displayed.
I want to avoid hard coding values in the winforms app, or using unbound public properties in the user control, because then I have to trust other developers to update them when they change the user control. I don't know if it's possible to bind a local variable to designheight or designwidth, or how to code that in XAML. Since I don't know a lot of WPF, there may be some other way to reach the goal that I don't know about.
Thanks for your help and advice.