Beginning WPF 4.5 by Full Example VB.Net

Your Price $14.99



Educating Professional Developers

This Book will be E-Delivered

Book Description

Beginning WPF 4.5 by Full Example VB.Net Description: This book will quickly show you (by full example) how to create fully functional WPF applications using VB.Net, XAML, and Visual Studio 2010 or 2012, SQL Server 2012, LINQ, Entity Framework, and the DataGrid. The examples in this book will include every single line of code that is required to execute. No assumptions will be made. The decision to write this book came from the need and frustration with finding real usable solutions. The purpose of this book is to “Learn by Full Example”. This is accomplished by eliminating lengthy useless explanations. Most developers prefer to learn by coding and not by reading boring long and drawn out text. If you need more details at any point, then refer to Microsoft's MSDN website. There you will find all the Microsoft detailed references. The goal is to save the next person from this same frustration. Most real world .NET development projects do not allow a developer to click wizards and create an application, based on requirements, by the private or government sector. In order to be a professional .NET developer in these situations one must be an expert with all aspects of code in WPF. That is with the language you are programming, the declarative markup code, and the SQL language for the database. One must also understand the definition of each of the property settings used for each user control. In additional to the classes that defines each user control. These are the prerequisites for becoming a successful professional .NET developer.

Look Inside Book

Table of Contents

Beginning WPF 4.5 by Full Example VB.Net. 1

Introduction. 7

WPF Basics. 8

Let's Get Started. 8

Let’s Learn By Example 1. 9

Steps to create Example 1. 9

Explanation of the code design. 10

String.Format. 10

Here is the full code listing of Example 1 in MainWindow.xaml.vb: 11

Let’s Learn by Example 2: Layout. 13

Grid Panel 13

Stack Panel 14

Uniform Grid. 14

Wrap Panel 14

Dock Panel 14

Canvas. 14

Steps to create Example 2 Layout. 14

Full XAML listing with explanation: 20

Let’s Learn by Example 3: TimeZone - Dependency Property. 28

Steps to create Example 3 Timezone. 28

Here is the full code listing for Example 3 Timezone – Dependency Property. 29

XAML Listing: 31

Let’s Learn by Example 4:  Attached Properties. 33

Steps to create Example 4 Attached Properties. 33

Explanation of the code design. 36

Here is the full code listing of Example 4: 37

XAML: 37

Code Behind: 38

Let’s Learn by Example 5: Resource Dictionary. 40

Steps to create Example 5. 40

Explanation of the code design. 45

Here is the full code listing of Example 5 Resource Dictionary : 46

XAML MainWindow.xaml: 46

Resource Dictionaries Dictionary1.xaml: 46

Resource Dictionaries Dictionary2.xaml: 47

Code Behind  MainWindow.xaml.cs: 47

Data Binding. 49

Let’s Learn by Example 6: Bind Using Attribute Syntax. 49

Steps to create Example 6. 49

Explanation of the code design. 51

Here is the full code listing of Example 6 Binding using attribute syntax : 53

XAML MainWindow.xaml : 53

Code Behind MainWindow.xaml.vb: 54

Summary. 54

ContentControl 55

Let’s Learn By Example 7: ControlTemplate. 56

Steps to create Example 7. 56

Explanation of the code design. 56

Here is the full code listing of Example 7 ControlTemplate : 64

XAML MainWindow.xaml : 64

Code Behind MainWindow.xaml.vb: 67

Class MainWindow.. 68

End ClassSummary. 68

Events. 68

Let’s Learn by Example 8: Events. 68

Steps to create Example 8. 68

Explanation of the code design. 69

Here is the full code listing of Example 8 Events : 72

XAML MainWindow.xaml : 72

Code Behind MainWindow.xaml.vb: 73

Pack URI 73

Let’s Learn by Example 9: Pack URI 74

Steps to create Example 9. 74

TIP:  Show All Files. 76

Explanation of the code design. 78

Here is the full code listing of Example 9 PackURI project : 79

XAML MainWindow.xaml : 80

Code Behind MainWindow.xaml.vb: 80

Let’s Learn by Example 10: Create Custom Commands. 81

Steps to create Example 10. 81

Explanation of the code design. 82

Here is the full code listing of Example 10 Create Custom Command project : 85

XAML MainWindow.xaml : 85

Code Behind MainWindow.xaml.vb: 86

Code Class WebBrowser.vb: 86

Let’s Learn By Example 11: MasterDetail l-LINQ-EF. 88

What is LINQ?. 88

What is Entity Framework?. 88

Steps to create Example 11. 88

Add the Northwind Database. 89

Add Entity Framework. 97

Full code listing with Explanation of the code design. 105

Code Behind MainWindow.xaml.cs: 105

XAML MainWindow.xaml : 107

App.Config. 112

Entity Framework Connection Strings. 112

Metadata. 113

Run the Application. 113

Let’s Learn by Example12-Drag and Drop DataGrid –EF. 116

Steps to create Example 12. 116

Add The Entity Data Model 116

Add New Data Source. 123

Use LINQ to Query Database. 126

Run the Application. 127

Full code listing in the WPFExample12-DragAndDropDataGridEF Project. 129

Code Behind MainWindow.xaml.cs: 129

MainWindow.xaml 130

App.Config. 132

App.xaml 132

Full Code Listings in the EFClassLibrary Project. 132

Class1.cs. 132

App.Config. 133

Summary. 134

About the Author. 135

 


Introduction

This book will quickly show you (by full example) how to create fully functional WPF applications using C#, XML, Microsoft SQL Server 2008/2012, XAML, Visual Studio 2010 or 2012, LINQ, Entity Framework, and the DataGrid.  The examples in this book will include every single line of code that is required to execute.  No assumptions will be made.  The decision to write this book came from the need and frustration with finding real usable solutions.  The purpose of this book is to “Learn By Full Example”.  This is accomplished by eliminating lengthy useless explanations.  Most developers prefer to learn by coding and not by reading boring long and drawn out text.  If you need more details at any point, then refer to Microsoft's MSDN website.  There you will find all the Microsoft detailed references.   The goal is to save the next person from this same frustration.

Most real world .NET development projects do not allow a developer to click wizards and create an application, based on requirements, by the private or government sector.  In order to be a professional .NET developer in these situations one must be an expert with all aspects of code in WPF.  That is with the language you are programming, the declarative markup code, and the SQL language for the database.  One must also understand the definition of each of the property settings used for each user control.  In additional to the classes that defines each user control.  These are the prerequisites for becoming a successful professional .NET developer
WPF Basics

Windows Presentation Foundation is the newer .NET framework platform that in my opinion replaces Windows forms and the old Win32 API's with a visually rich and intuitive user and developer experience. 

Let's Get Started

By Identifying and briefly discussing the minimum assemblies required to create a Windows Presentation Foundation application.  The Managed WPF layer is a set of classes and types built using the .NET Framework that is managed by the CLR (Common Language Runtime). This Managed WPF Layer comprise of three assemblies.

1.       PresentationCore is an assembly within the Managed WPF layer that contains the low-level classes and types that are the building blocks used by the PresentationFramework.

2.       PresentationFramework is another assembly within the Managed WPF layer that contains the classes and types that make up the API for programming in WPF.

3.       WindowsBase is another assembly within the Managed WPF layer that contains many of the fundamental types used in WPF programs, including the “Application” and “Window” classes, and dependency properties support.

The Media Integration layer is unmanaged code that maps the WPF constructs to DirectX. DirectX, in turn, maps them to the graphics card. This module is designed with unmanaged code for efficiency.

 

1.       FrameworkElement is a class within the PresentationFramework layer that contains the most important elements in the presentation framework.  It implements the logical tree model, styles, and animation support.

2.       UIElement is a WPF base class in the PresentationCore that implements support for the layout of the object, UI input, and lower-level animation support.  The UIElement supports a majority of the input-related events.  UIElement also catches input events like mouse clicks and keyboard entries and so they can be passed off to the appropriate event handlers

3.       Visual is another class in the PresentationCore that implements the bulk of the rendering tasks and hit testing or determining the boundaries of the bounding box of an element .