What is WPF and how does it compare to WinForms?

前端 未结 7 1939
星月不相逢
星月不相逢 2021-01-30 05:02

I\'ve been looking at WPF, but I\'ve never really worked in it (except for 15 minutes, which prompted this question). I looked at this post but its really about the \"Flash\" of

7条回答
  •  醉梦人生
    2021-01-30 06:02

    WPF is a vector graphics based UI presentation layer where WinForms is not. Why is that important/interesting? By being vector based, it allows the presentation layer to smoothly scale UI elements to any size without distortion.

    WPF is also a composable presentation system, which means that pretty much any UI element can be made up of any other UI element. This allows you to easily build up complex UI elements from simpler ones.

    WPF is also fully databinding aware, which means that you can bind any property of a UI element to a .NET object (or a property/method of an object), a property of another UI element, or data. Yes, WinForms supports databinding but in a much more limited way.

    Finally, WPF is "skinable" or "themeable", which means that as a developer you can use a list box because those are the behaviors you need but someone can "skin" it to look like something completely different.

    Think of a list box of images. You want the content to actually be the image but you still want list box behaviors. This is completely trivial to do in WPF by simply using a listbox and changing the content presentation to contain an image rather than text.

提交回复
热议问题