Problem?
<UI:PanelBrowser Margin="12,27,12,32"></UI:PanelBrowser>
WPF is ridiculous in that non-manually defined properties (such as width and height) in this case make them have values Doulbe.NaN. The problem is that I need to know this number. I will not manually set the width and height in XAML, because it does not allow resizing.
Given the above XAML snippet (this object is a simple subclass of the border control), how can I get the values of the Width and Height properties at runtime?
Edit:
Wow, I feel ridiculous. I read about ActualWidthand ActualHeight, but they successively returned 0 and 0 for me. The reason is that I tested these properties in the constructor of the Framework element before they were actually initialized. Hope this helps someone who is facing the same issue and experiencing errors. :)
source
share