How can I Host the WPF UserControl in Windows Forms ?

This can be done with the help of the following code : [C#[ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Windows.Forms.Integration; namespace WpfUserControlHost { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { // Create the ElementHost control for hosting the // WPF UserControl. ElementHost host = new ElementHost(); host.Dock = DockStyle.Fill; // Create the WPF UserControl. HostingWpfUserControlInWf.UserControl1 uc = new HostingWpfUserControlInWf.UserControl1(); // Assign the WPF UserControl to the ElementHost control’s // Child property. host.Child = uc; // Add the ElementHost control to the form’s // collection of child controls. this.Controls.Add(host); } } }

What is Serialization ?

Serialization is the process of converting the state of the object to a stream, so that it can be saved and transported. The reverse process of serialization is called Deserialization, where a stream is converted back to an object. The objective of serialization process is persistence of objects in an application. There are two types of Serialization: ’Binary and ’SOAP’ serialization respectively.

How can I use the BlockUIContainer element to host UIElement objects within Flow content ?

A BlockUIContainer is a flow content element that allows UIElement to be hosted inside the flow content. This can be done as follows. [XAML] <FlowDocument ColumnWidth=’400′> <Section Background=’GhostWhite’> <Paragraph> A UIElement element may be embedded directly in flow content by enclosing it in a BlockUIContainer element. </Paragraph> <BlockUIContainer> <Button>Click me!</Button> </BlockUIContainer> <Paragraph> The BlockUIContainer element may host no more than one top-level UIElement. However, other UIElements may be nested within the UIElement contained by an BlockUIContainer element. For example, a StackPanel can be used to host multiple UIElement elements within a BlockUIContainer element. </Paragraph> <BlockUIContainer> <StackPanel> <Label Foreground=’Blue’>Choose a value:</Label> <ComboBox> <ComboBoxItem IsSelected=’True’>a</ComboBoxItem> <ComboBoxItem>b</ComboBoxItem> <ComboBoxItem>c</ComboBoxItem> </ComboBox> <Label Foreground =’Red’>Choose a value:</Label> <StackPanel> <RadioButton>x</RadioButton> <RadioButton>y</RadioButton> <RadioButton>z</RadioButton> </StackPanel> <Label>Enter a value:</Label> <TextBox> A text editor embedded in flow content. </TextBox> </StackPanel> </BlockUIContainer> </Section> </FlowDocument>

What built-in commands are defined in the WPF framework?

WPF provides a library of common commands, which include ApplicationCommands ComponentCommands NavigationCommands MediaCommands EditingCommands Sample code given below: [XAML] <Window x:Class=’SDKSamples.Window1′ xmlns=’http://schemas.microsoft.com/winfx/2006/xaml/presentation’ xmlns:x=’http://schemas.microsoft.com/winfx/2006/xaml’ Title=’MenuItemCommandTask’> <DockPanel> <Menu DockPanel.Dock=’Top’> <MenuItem Command=’ApplicationCommands.Paste’ Width=’75’ /> </Menu> <TextBox BorderBrush=’Black’ BorderThickness=’2′ Margin=’25’ TextWrapping=’Wrap’> The MenuItem will not be enabled until this TextBox gets keyboard focus </TextBox> </DockPanel> <Window>