I am unclear about when you would use a UIElement
as opposed to a FrameworkElement
, and why is there a FrameworkElement
class at at all. Essentially, what is the extra functionality that a FrameworkElement
provides as opposed to UIElement
?
UIElement vs FrameworkElement
Asked Answered
possible duplicate of UIELement vs Frameworkelement in WPF/Silverlight –
Eoin
@mihajlv: The fact that the answer on that question may be wrong has nothing to do with whether it is a duplicate or not. –
Laurent
@mihajlv: Also binding has nothing to do with the dispatcher... –
Laurent
You should never inherit from UIElement
(no class besides FrameworkElement
does), among other properties it has no DataContext
, whose lack can land you in some troubles.
so just to be clear UIElement provides none of the layout, data binding, styling, templates, and resources. –
Krp
@H.B, how come UIElement have Measure and Arrange methods if it does not participate in layout? –
Epode
@EmperorAiman: The claim about it not participating in layout is presumably inaccurate, it seems to have some base capabilities but no concrete implementation and no way to adjust the size easily (as all those properties are missing). I don't know the reasoning between the separation of
UIElement
and FrameworkElement
but just looking at what classes exist it stands to reason that one wants to use FrameworkElement
. –
Laurent © 2022 - 2024 — McMap. All rights reserved.