WPF - Tutorials Point

 WPF

About the Tutorial

WPF stands for Windows Presentation Foundation. It is a powerful framework for building

Windows applications. This tutorial explains the features that you need to understand to

build WPF applications and how it brings a fundamental change in Windows applications.

Audience

This tutorial has been designed for all those readers who want to learn WPF and to apply

it instantaneously in different type of applications.

Prerequisites

Before proceeding with this tutorial, you should have a basic understanding of XML, Web

Technologies and HTML.

Copyright & Disclaimer

? Copyright 2018 by Tutorials Point (I) Pvt. Ltd.

All the content and graphics published in this e-book are the property of Tutorials Point (I)

Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish

any contents or a part of contents of this e-book in any manner without written consent

of the publisher.

We strive to update the contents of our website and tutorials as timely and as precisely as

possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.

Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our

website or its contents including this tutorial. If you discover any errors on our website or

in this tutorial, please notify us at contact@

i

WPF

Table of Contents

About the Tutorial .................................................................................................................................. i

Audience ................................................................................................................................................ i

Prerequisites .......................................................................................................................................... i

Copyright & Disclaimer ........................................................................................................................... i

Table of Contents .................................................................................................................................. ii

1.

WPF ¨C OVERVIEW .............................................................................................................. 1

WPF Architecture .................................................................................................................................. 1

WPF ¨C Advantages ................................................................................................................................. 2

WPF ¨C Features...................................................................................................................................... 2

2.

WPF ¨C ENVIRONMENT SETUP ............................................................................................ 3

Installation ............................................................................................................................................ 3

3.

WPF ¨C HELLO WORLD ........................................................................................................ 7

4.

WPF ¨C XAML OVERVIEW .................................................................................................. 12

Basic Syntax ......................................................................................................................................... 12

Why XAML in WPF ............................................................................................................................... 13

5.

WPF ¨C ELEMENTS TREE .................................................................................................... 17

Logical Tree Structure .......................................................................................................................... 17

Visual Tree Structure ........................................................................................................................... 18

6.

WPF ¨C DEPENDENCY PROPERTIES .................................................................................... 20

Why We Need Dependency Properties ................................................................................................ 21

Custom Dependency Properties .......................................................................................................... 22

7.

WPF ¨C ROUTED EVENTS ................................................................................................... 25

ii

WPF

Direct Event ......................................................................................................................................... 25

Bubbling Event .................................................................................................................................... 25

Tunnel Event ....................................................................................................................................... 25

Custom Routed Events ........................................................................................................................ 29

8.

WPF ¨C CONTROLS ............................................................................................................ 34

9.

BUTTON ........................................................................................................................... 37

10.

CALENDAR ....................................................................................................................... 46

11.

CHECKBOX ....................................................................................................................... 52

12.

COMBOBOX ..................................................................................................................... 62

13.

CONTEXTMENU ............................................................................................................... 69

14.

DATAGRID ........................................................................................................................ 76

15.

DATEPICKER ..................................................................................................................... 85

16.

DIALOG BOX ..................................................................................................................... 90

17.

GRIDVIEW ........................................................................................................................ 93

18.

IMAGE.............................................................................................................................. 99

19.

LABEL ............................................................................................................................. 104

20.

LISTBOX.......................................................................................................................... 108

21.

MENU ............................................................................................................................ 113

22.

PASSWORDBOX.............................................................................................................. 119

23.

POPUP ........................................................................................................................... 123

24.

PROGRESSBAR ............................................................................................................... 126

iii

WPF

25.

RADIOBUTTON ............................................................................................................... 130

26.

SCROLLVIEWER .............................................................................................................. 137

27.

SLIDER ............................................................................................................................ 143

28.

TEXTBLOCK .................................................................................................................... 148

29.

TOGGLEBUTTON ............................................................................................................ 151

30.

TOOLTIP ......................................................................................................................... 155

31.

WINDOW ....................................................................................................................... 158

32.

THIRD-PARTY CONTROLS ............................................................................................... 162

33.

WPF ¨C LAYOUTS ............................................................................................................. 169

Stack Panel ........................................................................................................................................ 169

Wrap Panel ........................................................................................................................................ 172

Dock Panel......................................................................................................................................... 175

Canvas Panel ..................................................................................................................................... 179

Grid Panel .......................................................................................................................................... 183

34.

NESTING OF LAYOUT...................................................................................................... 187

35.

WPF ¨C INPUT.................................................................................................................. 189

Mouse ............................................................................................................................................... 189

Keyboard .......................................................................................................................................... 193

ContextMenu or RoutedCommands .................................................................................................. 195

Multi Touch ....................................................................................................................................... 198

36.

WPF ¨C COMMAND LINE ................................................................................................. 203

37.

WPF ¨C DATA BINDING .................................................................................................... 208

iv

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download