Coffeehouse Post

Single Post Permalink

View Thread: Do you find WPF to be unnatural / unlogical?
  • User profile image

    Not to beat a dead horse but here's another example of the overly complex, academic nature of WPF. Tooltips shouldn't be this hard.

    Marco Zhou: The real problem here is that ToolTip alongside with ContextMenu will be treated as random properties for FrameworkElements, so ToolTip and ConextMenu will not be part of the element tree (either logical tree or visual tree), from my personal understanding, this could get some of the performance benefits, since when you shows a ToolTip or ContextMenu, you don't need to add them into the main element tree, and remove them when they are hidden. (note that big structure change within visual tree doesn't come for free).

    But the problem with this is that ElementName binding which replies on traversal of the logical tree to find the correct name scope to resolve the name of the element will fails, because any content within ToolTip and ContextMenu resides in their own element tree which is different from the main element tree.

    Fortunately, PlacementTarget is a good property to help us bridge between main element tree and the element tree presented by ToolTips and ContextMenus.

    I have to say that all those implementation details should be hidden from developers, and it would be better if WPF could come up with a method to hide such details, and make data binding work as it is with other typical scenario.

    Hopefully, future version of WPF could address this in a profound way.

    Hope this clears things up a little bit.

    WPF is a great framework. I really like how components can be built, reused, and how sometimes they just snap together and magically provide their function. Unfortunately WPF is also full of obscure implmentation details that could only be loved by the more academicly inclined while sipping thier tripple decaf soy lattes...