I have a Window that is autosized around it's content. For an animation I'd need it's width and height. ActualWidth is always the max width of the window, Width and Height properties say NaN.
ActualWidth/ActualHeight will give you the actual sizes of the window - given by the layout system, which is based on the actual rendering of the window. These should be the sizes you are looking for. However, there might be a slight delay in the calculation as it is based on rendering, so if they are wrong I guess they aren't calculated yet - and you got a race condition going on.. You can read more about this in links above, where there are some important notes on when the actual sizes are calculated - and hence - why they can be delayed.
Width/Height are requested sizes, and if not set explicitly they will hold their default values, which is Double.NaN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With