nikobarli
Topic Author
Posts: 178
Joined: 26 Apr 2017, 06:23

Fit a window into XAML content

23 Apr 2020, 08:39

Hi,

I want to create a popup window populated with a XAML, and I want that window to fit the size of the XAML content.
How can I know the correct size for the window.

# In WPF I think I can use the property SizeToContent to let the window automatically adjust its size.

https://docs.microsoft.com/en-us/dotnet ... mework-4.8

thanks.

Tags:
 
User avatar
sfernandez
Site Admin
Posts: 1912
Joined: 22 Dec 2011, 19:20

Re: Fit a window into XAML content

23 Apr 2020, 13:15

In the upcoming 3.0 version we implemented SizeToContent property in our Window implementation: #1631

Basically what we did is call Measure(INF, INF) on the content, and then AdjustWindowRect() to calculate the appropriate window size.
 
nikobarli
Topic Author
Posts: 178
Joined: 26 Apr 2017, 06:23

Re: Fit a window into XAML content

25 Apr 2020, 10:31

Basically what we did is call Measure(INF, INF) on the content, and then AdjustWindowRect() to calculate the appropriate window size.
Thank you. Will try to mimic that implementation. We are still using version 2.2 of NoesisGUI. I hope that will not block this feature.
 
User avatar
jsantos
Site Admin
Posts: 2904
Joined: 20 Jan 2012, 17:18
Contact:

Re: Fit a window into XAML content

25 Apr 2020, 12:59

Yes, the implementation of displays in 3.0 should be compatible with 2.2. Please, try it at let us know. Thanks!

Who is online

Users browsing this forum: No registered users and 1 guest