开发者

WPF: Why is it VisualTreeHelper.GetDrawing(Visual v) and not Visual.GetDrawing()?

开发者 https://www.devze.com 2022-12-19 11:19 出处:网络
Just curious -开发者_JS百科- prima facie it seems more awkward and less discoverable, but is there a good reason?I believe it is intentionally obfuscated a bit, because you shouldn\'t be directly fidd

Just curious -开发者_JS百科- prima facie it seems more awkward and less discoverable, but is there a good reason?


I believe it is intentionally obfuscated a bit, because you shouldn't be directly fiddling with the visual tree most of the time, fitting with the "Framework Design Guidelines" philosophy of "Commonly used classes should follow basic scenarios".

Since any method in Visual would be on pretty much any WPF control, they chose to put these advanced methods in a separate class. What the Framework designers are subtly trying to tell you is, "You shouldn't use this function unless you really know there's no better way to do what you're doing".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号