Skip to content

bruand81/WPF-Samples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WPF-Samples

This repo contains the samples that demonstrate the API usage patterns and popular features for the Windows Presenation Foundation in the .NET Framework for Desktop. These samples were initially hosted on MSDN, and we are gradually moving all the interesting WPF samples over to GitHub.All the samples have been retargeted to .NET 4.5.2.

For additional WPF samples, see WPF Samples.

License

Unless otherwise mentioned, the samples are released under the MIT license

Help us improve our samples

Help us improve out samples by sending us a pull-request or opening a GitHub Issue

Questions: mail [email protected]

WPF development

These samples require Visual Studio 2015 to build, test, and deploy.

Get a free copy of Visual Studio 2015 Community Edition with support for building WPF apps

Using the samples

The easiest way to use these samples without using Git is to download the zip file containing the current version (using the link below or by clicking the "Download ZIP" button on the repo page). You can then unzip the entire archive and use the samples in Visual Studio 2015.

Download the samples ZIP

Notes:

  • Before you unzip the archive, right-click it, select Properties, and then select Unblock.
  • Most samples should work independently
  • By default, all the sample target .NET 4.5.2, you can change this to .NET 4.6 in the Project->Properties page in Visual Studio.

For more info about the programming models, platforms, languages, and APIs demonstrated in these samples, please refer to the guidance available in MSDN. These samples are provided as-is in order to indicate or demonstrate the functionality of the programming models and feature APIs for WPF.

##Samples by category

Getting Started
Hello World Sample Simple Layout Complex Layout Dynamic Application Multipage Application
WPF Controls Gallery Sample Gallery
Base Elements
ContextMenuOpening Handlers Creating a FocusVisualStyle Finding the Index of an Element in a Panel Height Properties Loaded Even
Setting Margins ThicknessConverter Using Elements Visibility Changes to a UIElement Width Properties Comparison
Element Tree and Serialization
Overriding the Logical Tree Searching for an Element
Properties
Custom classes with Dependency Properties Restoring Default Values PropertyChanged and CoerceValue Callbacks
Events
Adding an Event Handler Custom Routed Events Finding a Source Element in an Event Handler
Routed Event Handling Sample
Input and Commands
Handling an Event When a Command Handling an Event When a Command Occurs Using Code Changing the Cursor Type Detecting Mouse Button State Firing Events When an Element Gains and Loses Focus
Keyboard Key Mouse Pointer Moving an Object with the Mouse Pointer Create Command Bindings Using Code Create a Custom RoutedCommand
EditingCommands Disable Command Source via Dispatcher Timer Disable Command Source via System Timer Capture and Uncapture Implement ICommandSource
Manipulate Focus Programmatically Count the Key Strokes of a Specific Key
Resources
Application Resources Defining a Resource Merged ResourceDictionary
Styles and Templates
Introduction to Styling and Templating Event Triggers Content Control Style Finding Template-Generated Elements Alternating the Appearance of Items
Themes
Threading
Multithreading Web Browser Single Threaded Application with Long Running Calculation Weather Service Simulation with Dispatcher
Digital Ink
MSDN
Accessibility
Test Script Generator(MSDN) TrackFocus FetchTimer Highlighter
InvokePattern, ExpandCollapsePattern, and TogglePattern SelectionPattern and SelectionItemPattern TextPattern Search and Selection
Application Management
Application Activation and Deactivation Application Cookies Application Shutdown Managing Unhandled Exceptions on Secondary UI Threads Managing Unhandled Exceptions on Secondary Worker Threads
Processing Command Line Arguments Reusable Custom Application Class Single Instance Detection Skinned Application Unhandled Application Exception
Navigation
MSDN
Application Extensibility
MSDN
Clipboard
Clipboard Spy Clipboard Viewer
DataBinding
Simple Binding Creating a Binding in Code Controlling the Direction and Timing of the Data Flow Binding with a Custom Value Converter Sorting and Filtering Items in a View
Sorting and Grouping Data in XAML Adding and Removing Groups Binding Validation Business Layer Validation Binding to XML Data
XMLDataProvider with Embedded Data File Binding Using XML Namespaces Introduction to Data Templating Binding Using Data Triggers Displaying Hierarchical Data
Binding the Properties of UI Elements Binding to a Collection Binding Using Composite Collections Master-Detail Scenario Using ObjectDataProvider Master-Detail Scenario Using XmlDataProvider
inding to the Results of a Method Implementing Property Change Notification Implementing Parameterized MultiBinding Binding Using PriorityBinding Showing System Colors Using Data Services
Explicitly Updating the Binding Source Binding to an ADO.NET DataSet Binding to a Web Service LINQ Query Formatting a String on a Binding
Changing a Collection by Using IEditableCollectionView Validate the Data of an Object Validate an Item in an ItemsControl
Drag & Drop
Drag and Drop an Object on a Canvas Create a Data Object from a Text Selection Drag-and-Drop Events Explorer Data Formats Spy Load a Dropped File
Thumb Drag Functionality
Globalization and Localization
Automatic Layout for Localizable Applications FlowDirection Gradient Grid for Localizable Applications Globalization Homepage
Globalization Run Dialog Image Implementing Localizable String Resources in XAML LanguageAttribute LeftToRight and RightToLeft
LocBaml Tool Numbers Numbers2 Numbers3 NumbersCSharp
Paths Resources for Localizable Applications RunSpan Span
Graphics
Bitmap Effects Brushes Geometries Imaging Shapes
Transformations
Animation
Animation Example Property Animation Animating the Opacity of an Element Animation Timing Behavior Custom Animation
From, To, and By Animation Target Values KeyFrame Animation Local Animations Key Spline Animation Path Animation/a>
Per-Frame Animation
Visual Layer
Using the CompositionTarget Hit Test Using DrawingVisuals Hit Test with Win32 Interoperation
Media
Media Gallery
Speech
Using Speech
Migration and Interoperability
Arranging Windows Forms Controls in WPF Data Binding in Hybrid Applications Enabling Visual Styles in a Hybrid Application
Hosting an ActiveX Control in WPF by Using XAML Hosting a Simple WPF in Windows Forms Hosting a Win32 ListBox Control in WPF
Hosting a Windows Forms Composite Control in WPF Hosting a Windows Forms Control in WPF Hosting a Windows Forms Control in WPF
Hosting WPF Content in a Win32 Window Hosting a WPF Composite Control in Windows Forms Localizing a Hybrid Application/a>
Mapping Properties Using the ElementHost Control Mapping Properties Using the WindowsFormsHost Element Win32 Clock Interoperation
Hosting a Win32 HWND in WPF
Sample Applications
Calculator Concentric Rings Cube Animation Data Binding Drop Shadow Ink
Editing Examiner ExpenseIt Font Dialog Box Geometry Designer WPF Photo Viewer
Graphing Calculator HexSphere Layout to Layout Transitions Logon Screen (MSDN) Notepad (MSDN)
Particle Effects Photo Store SDK Viewer Slide Puzzle Sticky Notes
XAML to HTML Conversion Video Viewer
Window Management
Customized Window UI Dialog Box Sample Hide a Window Without Closing MessageBox Non-Rectangular Windows
Notification Icon Save Window Placement State Show a Window Without Activating Window Activation and Deactivation Window Sizing Order of Precedence
Wizard

About

Repository for WPF related samples

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 94.9%
  • C++ 4.7%
  • Other 0.4%