http://archive.msdn.microsoft.com/wpfsamples
All Samples
All SamplesThis download contains all of the WPF documentation samples in a single package.
Download
Getting Started with WPF
Introduction to Building WPF ApplicationsThis sample provides an introduction to the development of a simple WPF application, and demonstrates controls, images, layout, and data binding.
Download |
Getting Started with WPF
WPF Controls Gallery SampleThis sample shows common usage scenarios and the default rendering behavior for many user interfaces and layout controls in WPF.
Download |
System.Windows.Controls Namespace
Application Samples
Video Viewer DemoThis sample creates a video viewing application that demonstrates styling, data binding, and data templating features.
Download |
Styling and Templating
Data Binding DemoThis sample creates a product listing application that allows users to enter items for sale. This sample demonstrates several data binding concepts.
Download |
Data Binding Overview
Particle Effects DemoThis sample application demonstrates how to produce particle effects within a System.Windows.Controls.Viewport3D.
Download |
Viewport3D Class
XBAP Hosting Silverlight SampleThis sample demonstrates how to host a Silverlight-based application in a XAML browser application (XBAP) and how to communicate between the host XBAP and the hosted Silverlight-based application.
Download |
WPF XAML Browser Applications Overview
WPF Windows Samples
MessageBox SampleThis sample demonstrates how to display a message box and get the message box return value.
Download |
Dialog Boxes Overview
Dialog Box SampleThis sample demonstrates how to use message boxes and common dialog boxes. This sample also shows how to create and use both modal and modeless dialog boxes.
Download |
Dialog Boxes Overview
Notification Icon SampleThis sample demonstrates how to display an icon in the notification area.
Download |
NotifyIcon Class
WPF Fundamentals
Height Properties SampleThis sample shows the differences among the height-related properties in WPF.
Download |
How to: Set the Height Properties of an Element
Width Properties Comparison SampleThis sample shows the differences among the width-related properties in WPF.
Download |
How to: Set the Width Properties of an Element
Input and Commands
Create a Custom RoutedCommand SampleThis sample shows how to create and use a custom System.Windows.Input.RoutedCommand.
Download |
Commanding Overview
Styles
Introduction to Styling and Templating SampleThis is a simple photo application that is designed to demonstrate how to use styling to create a visually compelling user experience.
Download |
Styling and Templating
Themes
Default WPF ThemesThe theme files in this section are created from the resource dictionaries containing each WPF theme and are provided as examples of how to create themes, as well as how to customize existing controls.
Download |
System.Windows.Controls Namespace
Threading
Single-Threaded Application with Long-Running Calculation SampleThis sample demonstrates how to keep the UI from becoming non-responsive in single threaded application which performs a long operation.
Download |
System.Windows.Threading Namespace
Controls
ListView with Multiple Views SampleThis sample shows how to create a System.Windows.Controls.ListView control that displays data in multiple view modes, which include the System.Windows.Controls.GridView and other custom view modes.
Download |
ListView Overview
TreeListView SampleThis sample shows how to create a custom TreeView that resembles the ListView when it uses the GridView.
Download |
TreeView Class
Popup Placement SampleThis sample creates a simple System.Windows.Controls.Primitives.Popup and lets the user position the System.Windows.Controls.Primitives.Popup.
Download |
Popup Placement Behavior
Control Customization
Styling with ControlTemplates SampleThis sample shows the System.Windows.Controls.ControlTemplate examples for the most common WPF controls. If you are replacing the System.Windows.Controls.ControlTemplate of a control, these examples are the best place to get started.
Download |
Styling and Templating
NumericUpDown Custom Control with Theme and UI Automation Support SampleThis sample demonstrates how to create a custom control that supports theming and UI automation.
Download |
Control Authoring Overview
ColorPicker Custom Control SampleThis sample shows how to create a custom control and display it in a dialog window. This sample defines a custom color picker control that enables users to browse colors by their hue, saturation, and brightness.
Download |
Dialog Boxes Overview
ResizingAdorner SampleThis sample implements a simple adorner that adds resizing handles to the element to which it is applied.
Download |
Adorner Class
Custom Radial Panel Sample
This sample shows how to derive a custom layout object from System.Windows.Controls.Panel that arranges its child elements in a radial pattern.
Download | Layout System

Create a Custom Content-Wrapping Panel Sample
This sample shows how to override the default layout behavior of the System.Windows.Controls.Panel element.
Download | How to: Create a Custom Panel Element

Layout
WPF Layout Gallery SampleThis sample provides a set of overview documents and samples that visually introduce you to the layout system in WPF.
Download |
Layout System
Data Binding
Binding Validation SampleThis sample shows how to implement data validation on the UI layer using binding.
Download |
How to: Implement Binding Validation
Introduction to Data Templating SampleThis sample demonstrates how to use System.Windows.DataTemplate, System.Windows.DataTrigger, and System.Windows.Controls.DataTemplateSelector to specify the presentation of your data.
Download |
Data Templating Overview
Changing a Collection by Using IEditableCollectionView SampleThis sample uses the members that are provided by the System.ComponentModel.IEditableCollectionView interface to add and change items in a System.Windows.Controls.ListView.
Download |
IEditableCollectionView Interface
Sorting and Filtering Items in a View SampleThis sample shows how to use a collection view to apply a sort order and filtering.
Download |
How to: Filter Data in a View
Drag and Drop
Drag and Drop an Object on a Canvas SampleThis example shows how to move objects on a System.Windows.Controls.Canvas using drag and drop. In addition, this sample shows how to apply an adorner and an animation to the object as it is being moved.
Download |
Drag and Drop Overview
Load a Dropped File SampleThis sample will open and display the contents of a text file dropped on the sample.
Download |
DataObject Class
Thumb Drag Functionality SampleThis example shows how to use a System.Windows.Controls.Primitives.Thumb to resize a System.Windows.Controls.Canvas control by responding to the System.Windows.Controls.Primitives.Thumb.DragDelta event.
Download |
How to: Use a Thumb to Enable Dragging
Packaging
Reading a Package SampleThis sample shows how to read content, resource, and relationship parts from a XML Paper Specification (XPS) System.IO.Packaging.Package.
Download |
Documents in WPF
Writing a Package SampleThis sample shows how to write content, resource, and relationship parts to a XML Paper Specification (XPS) System.IO.Packaging.Package.
Download |
Documents in WPF
Creating a Package with a Digital Signature SampleThis sample shows how to write a XML Paper Specification (XPS) package with digitally signed content, and then read and validate the signed elements.
Download |
PackageDigitalSignatureManager Class
Typography
Advanced Text Formatting SampleThis sample shows how to create and use the Microsoft .NET Framework text engine.
Download |
Advanced Text Formatting
Brushes
Brushes SampleThis sample shows how to paint with solid colors, gradients, images, and drawings. It shows how to use features common to all brushes, such as the System.Windows.Media.Brush.Transform, System.Windows.Media.Brush.RelativeTransform, and System.Windows.Media.Brush.Opacity properties. It also demonstrates how to animate System.Windows.Media.SolidColorBrush and System.Windows.Media.GradientBrush objects.
Download |
WPF Brushes Overview
ImageBrush SampleThis sample shows how to use an System.Windows.Media.ImageBrush to paint an area with an image. It also shows how to create patterns from an image.
Download |
WPF Brushes Overview
VisualBrush SampleThis sample shows how to use a System.Windows.Media.VisualBrush to paint an area with text, controls, and shapes. It also shows how to use a visual brush to magnify a portion of the screen and create a reflection.
Download |
WPF Brushes Overview
Opacity Masking SampleThis sample shows how to create opacity masks and apply them to elements.
Download |
DrawingBrush Class
Geometries
Geometries SampleThis sample shows how to create and use geometries.
Download |
Geometry Overview
Point SampleThis sample demonstrates the different operations of the System.Windows.Point structure.
Download |
Point Structure
Vector SampleThis sample shows how to use the various methods and properties of the System.Windows.Vector structure.A list of radio buttons is created that selects the operation to perform.
Download |
Vector Structure
Clip Region SampleThis sample shows how to define System.Windows.UIElement.Clip regions.
Download |
How to: Animate a Clip Region
Converter SampleThis sample shows how to use the converter classes to convert an instance of a type into a string.
Download |
PointConverter Class
Images
ImageView SampleThis sample shows a simple image viewing utility using the System.Windows.Controls.Image and System.Windows.Media.Imaging.BitmapImage objects.
Download |
Imaging Overview
Win32 Sample CodecThis sample demonstrates how to create a custom codec can be built using the unmanaged WPF Imaging Component API.
Download |
Imaging Overview
Shapes
Shape Elements SampleThis sample shows how to draw by using the following System.Windows.Shapes.Shape elements:
System.Windows.Shapes.Ellipse, System.Windows.Shapes.Line, System.Windows.Shapes.Path, System.Windows.Shapes.Polygon, System.Windows.Shapes.Polyline, and System.Windows.Shapes.Rectangle.
Download |
WPF Graphics, Animation, and Media Overview
Transformations
2-D Transforms SampleThis sample shows how to create, use, and animate two-dimensional transforms.
Download |
Transforms Overview
Matrix SampleThis sample shows how to use the various methods and properties of the System.Windows.Media.Matrix structure.
Download |
Matrix Structure
3-D Graphics
3-D Hit Testing SampleThis sample provides information about hit testing on an animated 3-D model.
Download |
How to: Hit Test in a Viewport3D
3-D Lights SampleThis sample shows how to use the various methods and properties of the System.Windows.Media.Media3D.AmbientLight, System.Windows.Media.Media3D.DirectionalLight, and System.Windows.Media.Media3D.PointLight, objects.
Download |
System.Windows.Media.Media3D Namespace
3-D Mesh SampleThis sample shows how to build meshes and group models to compose a 3-D scene in procedural code.
Download |
Point3DCollection Class
3-D Scene SampleThis sample shows how to create and draw in a 3-D scene.
Download |
3-D Graphics Overview
3-D Scene Animation Rotation Code SampleThis sample shows how to animate a rotation transformation on a 3-D model in procedural code.
Download |
PerspectiveCamera Class
3-D Solids SampleThis sample applies images to several different 3-D models and shows how to re-use application resources in building a 3-D scene.
Download |
System.Windows.Media.Media3D Namespace
Animated Rotation Markup SampleThis sample shows how to animate a rotation transformation on a 3-D model.
Download |
3-D Transformations Overview
MatrixTransform3D Viewer SampleThis sample provides a 3-D scene and some basic controls to demonstrate the effects of different Matrix3D values on transformations applied to a 3-D model.
Download |
3-D Transformations Overview
Point3D SampleThis sample shows how to use the various methods and properties of the System.Windows.Media.Media3D.Point3D structure.
Download |
Point3D Structure
Point4D SampleThis sample shows how to use the various methods and properties of the System.Windows.Media.Media3D.Point4D structure.
Download |
Point4D Structure
Quaternion Viewer SampleThis sample provides a 3-D scene and some basic controls to demonstrate the effects of different quaternion values on transformations applied to a 3-D model.
Download |
System.Windows.Media.Media3D Namespace
Size3D SampleThis sample shows how to use the various methods and properties of the System.Windows.Media.Media3D.Size3D structure.
Download |
Size3D Structure
Vector3D SampleThis sample shows how to use the various methods and properties of the System.Windows.Media.Media3D.Vector3D structure.
Download |
Vector3D Structure
UIElement3D Sphere SampleThis sample shows how to create a Sphere class that derives from System.Windows.UIElement3D.
Download |
UIElement3D Class
Interactive 2-D on 3-D SampleThis sample demonstrates how to place interactive 2-D content, a button in this case, on a 3D object, using the System.Windows.Media.Media3D.Viewport2DVisual3D class.
Download |
Viewport2DVisual3D Class
Handling Events in 3-D SampleThis sample demonstrates how to create 3-D objects that respond to events using the System.Windows.Media.Media3D.ContainerUIElement3D and System.Windows.Media.Media3D.ModelUIElement3D classes. In particular, this sample creates two cubes that respond to mouse-down events.
Download |
UIElement3D Class
Animations
Animation Example GalleryThis sample shows how to animate a variety of objects, include text, 2-D transforms, and 3-D transforms. It also demonstrates splined interpolation, path animations, and custom animations.
Download |
Animation Overview
Animating the Opacity of an Element SampleThis sample shows how to animate the System.Windows.UIElement.Opacity of an element.
Download |
How to: Animate the Opacity of an Element or Brush
Animation Timing Behavior SampleThis sample shows how to specify when an animation starts, how many times it repeats, whether it accelerates or decelerates, and other timing behaviors.
Download |
Timing Behaviors Overview
Custom Animation SampleThis sample shows how to create custom animations that simulate bouncing and other interesting effects.
Download |
Custom Animations Overview
From, To, and By Animation Target Values SampleThis sample shows how to use the System.Windows.Media.Animation.DoubleAnimation.From, System.Windows.Media.Animation.DoubleAnimation.To, and System.Windows.Media.Animation.DoubleAnimation.By values of an animation.
Download |
From/To/By Animations Overview
KeyFrame Animation SampleThis sample shows how to use key frame animations to animate along a set of target values.
Download |
Key-Frame Animations Overview
Key Spline Animation SampleThis sample enables you to interactively adjust the key spline of a System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames.
Download |
Key-Frame Animations Overview
Path Animation SampleThis sample shows how to animate an object along a geometric path.
Download |
Path Animations Overview
Visual Layer Programming
Using the CompositionTarget SampleThis sample illustrates how to use System.Windows.Media.CompositionTarget object to create custom drawings or animations based on a per-frame callback.
Download |
How to: Render on a Per Frame Interval Using CompositionTarget
Hit Test Using DrawingVisuals SampleThis sample demonstrates how to use System.Windows.Media.DrawingVisual objects to create lightweight graphics. The sample also shows how to implement hit testing at the visual object level.
Download |
Using DrawingVisual Objects
Hit Test with Win32 Interoperation SampleThis sample demonstrates how to use the default hit testing support in the visual layer of WPF.
Download |
Hit Testing in the Visual Layer
Globalization and Localization
Globalization Homepage SampleThis example demonstrates how to build and localize a Homepage.
Download |
WPF Globalization and Localization Overview
LocBaml Tool SampleThis sample demonstrates how to use the LocBaml tool to parse input files to create localizable resources and generate a localized binary. The C# files build the tool and the XAML files build a DLL to use as input for the LocBaml tool.
Download |
WPF Globalization and Localization Overview
Migration and Interoperability
Hosting a Windows Forms Control in WPF SampleThis sample demonstrates how to host a Windows Forms control in a WPF application.
Download |
Walkthrough: Hosting a Windows Forms Control in WPF
Hosting a Windows Forms Control in WPF by Using XAML SampleThis sample demonstrates how to host a Windows Forms control in a WPF application by using XAML.
Download |
Walkthrough: Hosting a Windows Forms Control in WPF by Using XAML
Hosting a Windows Forms Composite Control in WPF SampleThis sample shows you how to host a Windows Forms data-entry composite control in a WPF application. It shows how to receive events and acquire data from the control and modify the control's properties.
Download |
Walkthrough: Hosting a Windows Forms Composite Control in WPF
Enabling Visual Styles in a Hybrid Application SampleThis sample shows how to enable Microsoft Windows XP visual styles on a Windows Forms control hosted in a WPF-based application.
Download |
How to: Enable Visual Styles in a Hybrid Application
Arranging Windows Forms Controls in WPF SampleThis sample shows how to use WPF layout features to arrange Windows Forms controls in a hybrid application.
Download |
Walkthrough: Arranging Windows Forms Controls in WPF
Data Binding in Hybrid Applications SampleThis sample shows how to bind WPF and Windows Forms controls to a common data source and display the results in a master/detail form.
Download |
Walkthrough: Binding to Data in Hybrid Applications
Hosting a 3-D WPF Composite Control in Windows Forms SampleThis sample demonstrates how to host a WPF composite control that displays a three-dimensional (3-D) cone in a Windows Forms application.
Download |
Walkthrough: Hosting a 3-D WPF Composite Control in Windows Forms
Hosting a WPF Composite Control in Windows Forms SampleThis sample demonstrates how to host a WPF data-entry composite control in a Windows Forms application. It shows how to receive events and acquire data from the control and modify the control's properties.
Download |
Walkthrough: Hosting a WPF Composite Control in Windows Forms
Mapping Properties Using the ElementHost Control SampleThis sample shows how to use the System.Windows.Forms.Integration.ElementHost.PropertyMap property to map Windows Forms properties to corresponding properties on a hosted WPF element.
Download |
Walkthrough: Mapping Properties Using the ElementHost Control
Mapping Properties Using the WindowsFormsHost Element SampleThis sample shows how to use the System.Windows.Forms.Integration.WindowsFormsHost.PropertyMap property to map WPF properties to corresponding properties on a hosted Windows Forms control.
Download |
Walkthrough: Mapping Properties Using the WindowsFormsHost Element
Localizing a Hybrid Application SampleThis sample shows how to localize WPF elements in a Windows Forms-based hybrid application.
Download |
Walkthrough: Localizing a Hybrid Application
Hosting a Win32 HWND in WPF SampleThis sample shows how to put an hwnd inside a WPF application.
Download |
WPF and Win32 Interoperation
Hosting a Win32 ListBox Control in WPF SampleHosts a Win32 ListBox control in a WPF application. This sample shows how to create and host the control, and how to send and receive messages.
Download |
Walkthrough: Hosting a Win32 Control in WPF