Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 464 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
464
Dung lượng
7,07 MB
Nội dung
[...]... technology, requires a good understanding of its foundations This understanding makes it possible to grasp the more complex aspects of that technology; Windows PresentationFoundation (WPF) is no different In this first chapter, we'll discuss recipes concerning the very foundations of WPF – what makes it tick—and also along the way, what makes it unique Foundations XAML The first noticeable facet of... to perform asynchronous operations 423 428 430 Index 439 iv Preface Windows PresentationFoundation has been in release since late 2006, as a part of the then NET 3.0 Framework, also preinstalled on Windows Vista at the time It promised to change the way rich client applications are written, and eventually replace the old, Win32-based Windows Forms WPF gained traction slowly because of its enormous breadth... by understanding the foundations well, it’s possible to tackle any problem This is why I have tried to emphasise the why, and not just the how WPF led to a bunch of other technologies being built on similar principles, namely Silverlight (cross browser web client development in NET), Windows Phone 7.x (Microsoft’s Phone OS that uses a Silverlight variant), and lately Windows 8 and Windows Phone 8—all... namespaces are declared by a typical XAML file: the first, which is the default XML namespace, is mapped to the normal WPF namespaces (System .Windows, System .Windows. Controls, and so on) The other, typically with the x prefix, is mapped to the XAML namespace (System .Windows. Markup) For our own types, we need to do similar mapping (but with a different syntax) means map the XML namespace prefix local to... single XML namespace to multiple NET namespaces This is the same technique used by the WPF assemblies itself: a single XML namespace maps to multiple WPF namespaces, such as System .Windows, System .Windows. Controls, and System .Windows. Media The trick is to use the XmlnsDefinition attribute within the assembly where the exported types reside This only works for referenced assemblies; that is, it's typically... controls in WPF and how they are typically used The content model is also discussed, along with other control families Chapter 5, Application and Windows, takes a look at a WPF application from a higher perspective, including application level resources and the way windows are used and managed Chapter 6, Data Binding, discusses the powerful and important concept of data binding and the way it’s used in WPF,... interfaces Actually, XAML has nothing to do with UI It's merely a declarative way of constructing objects and setting their properties In fact, it's leveraged in other technologies, such as the Windows Workflow Foundation (WF), where it's used as a way of constructing workflows To create objects in XAML, they must be "XAML friendly" – meaning they must have the following: ff A public default constructor... and visual inheritance In fact, most of the various element properties are Dependency Properties Sometimes we need to create such properties for our own controls or windows Getting ready Make sure you have Visual Studio up and running 15 Foundations How to do it We'll create a simple user control with one new dependency property to illustrate the entire procedure: 1 Within Visual Studio 2010, create... and our ability to bring you valuable content Questions You can contact us at questions@packtpub.com if you are having a problem with any aspect of the book, and we will do our best to address it 5 1 Foundations In this chapter we will cover the following: ff Creating custom type instances in XAML ff Creating a dependency property ff Using an attached property ff Creating an attached property ff Accessing... with checkboxes and radio buttons 139 Manipulating tab order and focus 141 Introduction 145 Creating a window 145 Creating a dialog box 149 Using the common dialog boxes 153 Creating ownership between windows 156 Creating a custom shaped window 158 Creating a single instance application 162 Handling an unhandled exception 166 Introduction 169 Element to element binding 170 Binding to a single object . Windows 1 45
Introduction 1 45
Creating a window 1 45
Creating a dialog box 149
Using the common dialog boxes 153
Creating ownership between windows 156
Creating. alt=""
Windows Presentation
Foundation 4. 5
Cookbook
Over 80 recipes to effectively and efciently
develop rich Windows client applications on
the Windows