What is WPF for the WinForms programmer?

后端 未结 8 536
余生分开走
余生分开走 2021-02-04 11:42

What is WPF to the WinForms programmer?

WinForms distilled is adding controls to forms, and adding event handlers. This is simple and easy and allows you to make functio

8条回答
  •  后悔当初
    2021-02-04 11:47

    WPF brings

    • Declarative UI Programming: The presentation or look of the UI (XAML) has been separated from the code (.cs et. all) such that the XAML can be created independently by people who are good at that sort of thing - graphic designers. They then submit their finished look to the developers who just write the code to make it work. (Simpler stuff can be handled again directly in XAML) Supposed to give you greater parallelism and good UX (as opposed to developer-approved-UIs)
    • Data Binding: Again a declarative bent.. You declarative specify which model property this UI control renders, WPF takes care of pulling the data into the control & updating modified contents back along with change notifications.
    • Improved Composite Control Model - You can now embed almost anything within anything so now imagination knows no bounds.
    • Data Templates, Control Templates etc.. - again separation of UI from code. These XAML templates specify (once) how a data structure or UI Control should look to the user.
    • Better at X: Ofcourse MS improved on a bunch of other aspects like rendering (fewer updates that GDI), Scaling (resolution independence), Transparency, Layouts (Non-absolute), Text rendering, Animation & Video support, An Improved Event Model, et. all
    • Styles, Triggers : Easier to apply uniform look-n-feel globally with in-one-place styles (XAML again). Triggers are blocks of code that execute when some event occurs e.g. 'the text of this control changed.. so now update its foreground property to blue to indicate "modified"'. Simple stuff can be done directly in XAML.

提交回复
热议问题