tag:blogger.com,1999:blog-4886301839106291376.post1042511477151983926..comments2023-09-23T03:36:30.513+10:00Comments on Things I Hate About Microsoft: Random properties in WPF UI ElementsChristian Graushttp://www.blogger.com/profile/13444285493681626756noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-4886301839106291376.post-53720524627212575892010-08-30T23:28:57.283+10:002010-08-30T23:28:57.283+10:00Width = how wide you want the thing to be.
ActualW...Width = how wide you want the thing to be.<br />ActualWidth = how wide the thing has actually been rendered.<br /><br />For ex., a TextBox with horizontalAlignment=stretch and Width=NaN will take all the available space. ActualWidth will tell you how much space has been assigned to it.<br /><br />Documentation is your friend.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-4886301839106291376.post-27798604036789696132010-05-15T03:22:37.102+10:002010-05-15T03:22:37.102+10:00As far as I can tell, the Width property may repor...As far as I can tell, the Width property may report a bogus number (like 0 or infinity) when the Width is set to "Auto" or SizeToContent includes Width; thus the need for ActualWidth.<br />You may also find Window.RestoreBounds useful for checking position or size.Bahls Daddyhttps://www.blogger.com/profile/11888736510764848189noreply@blogger.comtag:blogger.com,1999:blog-4886301839106291376.post-67587190936947578912010-05-04T09:10:38.033+10:002010-05-04T09:10:38.033+10:00Oh, duh. I did not try that, although I DID find ...Oh, duh. I did not try that, although I DID find MS documentation telling me that says the position is not properly tracked during a drag operation, so I assumed there was no way to do it, based on the docs. I even mentioned in my post that these 'Actual' properties exist, but I've never used ActualLeft and Top, only the Width and Height. I still don't know why the Width and the ActualWidth are two different things, however.Christian Graushttps://www.blogger.com/profile/13444285493681626756noreply@blogger.comtag:blogger.com,1999:blog-4886301839106291376.post-60488172118375791082010-04-30T18:16:45.730+10:002010-04-30T18:16:45.730+10:00Did you try ActualTop and ActualLeft? :)Did you try ActualTop and ActualLeft? :)Andrew Voshttps://www.blogger.com/profile/06496219685737899664noreply@blogger.com