Tuesday, October 19, 2010

Host WPF Controls in Windows Forms

To host a WPF control or WPF user control (wpfControl in this example) into Windows Form application, create an instance of ElementHost Class and add your WPF control/user control as child to the instance of ElementHost.

using System.Windows.Forms.Integration; 
//Assembly:   WindowsFormsIntegration (in WindowsFormsIntegration.dll)

ElementHost elementHost = new ElementHost();
elementHost.Dock = DockStyle.None;
elementHost.Child = wpfControl;

Now, add the instance of ElementHost to a container control in your windows form (for instance containerPanel here)

containerPanel.Controls.Add(elementHost);

Monday, October 4, 2010

Online WPF Learning Material (Updated)

Save Google from doing it again. I've done it already.

MVVM in WPF
An introduction to the Model-View-ViewModel (MVVM) pattern in WPF

Walkthrough: Getting Started with WPF
WPF's official education library from Microsoft.

WindowsClient.NET
An excellent list of video tutorials useful to beginners and proficient WPF programmers. My personal favorite in WPF video tutorials.

WPFTutorials.NET
Great collection of WPF tutorials including source code examples. Right place to start learning WPF from.

WPF Tutorial
Nice tutorials for beginners including WPF basics, Layout - Panels & Containers, Borders, TypeConverter & MarkupExtensions to XAML, Dependency Property System and Concept Binding.

WPF Tutorial (dotnetslackers.com)
Good resource to start for beginners providing general overview of the key concepts and innovations of WPF.

WPF Wonderland
Collection of adhoc task related articles about  WPF and Silverlight.

Josh Smith's Blog
Expert articles on WPF and Silverlight.

WPF - Beginners tutorial
One page tutorial on basics of WPF.

XAML Basics
Mutlipage introduction to XAML. Useful for WPF and Silverlight beginners.

WPF: A Beginner's Guide (CodeProject.com)
Multipart WPF tutorial series. CodeProject articles rock!

Windows Presentation Foundation (CodeProject.com)
Huge and excellent collection of useful adhoc articles on WPF. Includes a number of sample applications.


WPF Apps With The MVVM Design Pattern
Official content on The Model-View-ViewModel Design Pattern for WPF from MS.


Many more to be explored and to be appended..