简体   繁体   English

WPF基本面?

[英]WPF fundamentals?

At the University we teach .NET (both VB and C#) using Windows Forms. 在大学,我们使用Windows Forms教授.NET(包括VB和C#)。 We want to introduce the concept of Windows Presentation Foundation (WPF) to our advanced course. 我们想在我们的高级课程中介绍Windows Presentation Foundation(WPF)的概念。 Which fundamentals of WPF does students need to learn in order to get the basic knowledge of WPF? 为了获得WPF的基本知识,学生需要学习哪些WPF基础知识?

The idea is for student to use WPF in at least one of six assignments, and to learn all of these WPF Fundamentals seems a bit daunting. 这个想法是让学生在六个任务中至少有一个使用WPF,并且学习所有这些WPF基础知识似乎有点令人生畏。 Which three-four basics is considered mandatory? 哪三个基础被认为是强制性的?

Thanx for your time! 谢谢你的时间!

Here is the list. 这是清单。 I prepared for my junior programmer. 我为我的初级程序员做好了准备。

1) XAML Basics & Basic controls such as TextBox, Buttons etc., 1)XAML基础和基本控件,如TextBox,Buttons等,
2) VisualTree and LogicalTree 2)VisualTree和LogicalTree
3) Bubbling and Tunneling 3)鼓泡和隧道

4) DependencyProperty 4)DependencyProperty
5) AttachedProperty 5)AttachedProperty

6) DataTemplate 6)DataTemplate
7) ControlTemplate 7)ControlTemplate

8) Style 8)风格

9) DataBinding 9)DataBinding

Triggers: 触发器:
10) EventTriggers 10)EventTriggers
11) DataTriggers 11)DataTriggers

MVVM Basics & Commands: MVVM基础知识和命令:
12) DelegateCommand 12)DelegateCommand
13) RelayCommand 13)RelayCommand
14) ApplicationCommands 14)ApplicationCommands
15) RoutedEvent 15)RoutedEvent
16) RoutedCommand 16)RoutedCommand

Transformations: 转换:
17) RenderTransform 17)RenderTransform
18) LayoutTransform 18)LayoutTransform

Resources: 资源:
19) BinaryResource 19)BinaryResource
20) LogicalResource 20)LogicalResource
21) StaticResource 21)StaticResource
22) DynamicResource 22)DynamicResource
23) RelativeResource 23)RelativeResource

Panles and Basic Controls: Panles和Basic Controls:
24) Layouts and Panels 24)布局和面板
25) UserControl 25)UserControl
26) ContentControl 26)ContentControl
27) Some Controls like Grid, TreeView and Charts 27)一些控件,如Grid,TreeView和Charts

Interfaces and Collections: 接口和集合:
28) IValueConverter 28)IValueConverter
29) INotifyPropertyChanged 29)INotifyPropertyChanged
30) ObservableCollection 30)ObservableCollection
31) CollectionViewSource 31)CollectionViewSource

HTH HTH

I really don't believe that three or four topics is enough. 我真的不相信三四个主题就够了。 But talking about highest priorities, I'd say 但是我会说,谈论最高优先级

  1. XAML and markup extensions, XAML和标记扩展,
  2. Layout and panels, 布局和面板,
  3. Routed events, 路线活动,
  4. Dependency- and attached properties. 依赖性和附加属性。

If you think about how to didactically structure your course, you should consider Petzold's book . 如果您考虑如何在课程中进行教学结构,您应该考虑Petzold的书 The way he structures his chapters works perfectly well for live courses. 他构建章节的方式非常适合现场课程。 It is very fine tuned didactically and we made some good experience structuring a course around this book. 它在教学上非常精细,我们在构建本书的课程方面取得了很好的经验。 We have also made the experience that it works especially well for people with a Windows Forms background. 我们还体验到它对于具有Windows窗体背景的人来说特别有效。 It starts out with code only (c#) and only later introduces XAML. 它仅以代码(c#)开头,后来才引入XAML。 This helps a great deal to grasp the concepts of the framework. 这有助于掌握框架的概念。

Dependency Properties , Routed Events and layout model are absolutely necessary in my opinion. 在我看来, 依赖属性路由事件布局模型是绝对必要的。 Data Binding & MVVM come next. 数据绑定MVVM接下来。

I'm not a WPF guru, but i think that technically, WPF is much more complex, that Windows Forms, and if students are common with later, it will be hard to code using a "WPF-way" ( especially, if there is no html/xml background ). 我不是WPF大师,但我认为从技术上来说,WPF要复杂得多,即Windows Forms,如果学生以后很常见,使用“WPF方式”很难编码(特别是,如果有的话)是没有html / xml背景)。 I doubt, that it is possible to write robust code using WPF without knowing some major aspects of it. 我怀疑,使用WPF编写健壮的代码是可能的,而不知道它的一些主要方面。 WPF is really a bad choice for quick or simple UI's. 对于快速或简单的UI,WPF确实是一个糟糕的选择。 It needs a considerable amount of learning time to dive in. 潜水需要相当多的学习时间。

They're all called fundamentals for a reason. 出于某种原因,他们都被称为基本面。 You should have at least a basic understanding of all of them if you're planning on building any sort of successful WPF application. 如果您计划构建任何类型的成功WPF应用程序,那么您应该至少对所有这些知识有基本的了解。

If I had to single some things out so that your class could at least get started with building something, I would probably say: 如果我不得不单独解决一些事情,以便你的班级至少可以开始构建一些东西,我可能会说:

XAML and Data Binding are both musts. XAML和数据绑定都是必须的。 Dependency Properties are a close second. 依赖属性紧随其后。 Input/Commands/Routed Events all would be included as well. 输入/命令/路由事件也都包括在内。

I found Charles Petzhold's book "Applications = Code + Markup" to be extremely helpful when I started out with WPF. 当我开始使用WPF时,我发现Charles Petzhold的书“Applications = Code + Markup”非常有用。 The first half of the book is entirely C# code, teaching the basic concepts of WPF (dependency properties, eventing, etc.) with no XAML whatsoever. 本书的前半部分完全是C#代码,教授WPF的基本概念(依赖属性,事件等),没有任何XAML。 The second half of the book introduces the concept of XAML and how it relates to everything you learned in the first half of the book. 本书的后半部分介绍了XAML的概念,以及它与本书上半部分学到的内容之间的关系。 If I were teaching a class on WPF, I would definitely lay things out in a similar way -- teach the concepts in code first, then introduce XAML. 如果我在WPF上教课,我肯定会以类似的方式解决问题 - 首先在代码中教授概念,然后介绍XAML。

Although this is quite subjective, I think a good four would be (from that link): 虽然这是非常主观的,但我认为好的四个(从那个链接):

  • Element Tree and Serialization : This is completely new from WinForms to WPF and getting an understanding of how the Visual and Logical tree's work is quite important in understanding how things get done in WPF. 元素树和序列化 :这是从WinForms到WPF的全新内容,让我们了解Visual和Logical树的工作对于理解WPF中的工作方式非常重要。
  • Events (WPF) - Again, this varies substantially from WinForms and brings in all the goodies of WPFs event modelling. 事件(WPF) - 再次,这与WinForms有很大不同,并带来了WPF事件建模的所有好处。
  • Styles and Templates - This is what brings WPF to life. 样式和模板 - 这就是WPF的生命。 All the bindings to the UI and what not also fall into this category. 所有绑定到UI以及不属于此类别的内容。
  • Layout System - Well, it's WPF isn't it? 布局系统 - 嗯,WPF不是吗? The layout is an integral part of the process. 布局是整个过程的一个组成部分。

Apart from these, Dependency Properties are Important as well as at least understanding how XAML works. 除此之外, 依赖属性是重要的,至少要了解XAML的工作原理。 There is no real "only option" when it comes to WPF. WPF 没有真正的“唯一选择”。 It's a brand new way of doing things if you have worked with models such as WinForms. 如果您使用WinForms等模型,这是一种全新的做事方式。 I would try to learn as much as possible. 我会尽量学习。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM