Use a Frame control to navigate to Web pages and a Extensible Application Markup Language (XAML) page.


   
  


<Page x:Class="FrameExample.Page1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <StackPanel>
        <RadioButton Name="VisualBasic" Checked="BrowseAHomePage" GroupName="HomePages">
      Visual Basic
        </RadioButton>
        <RadioButton Name="VisualCSharp" Checked="BrowseAHomePage" GroupName="HomePages">
      Visual C# 
        </RadioButton>
        <RadioButton Name="AnotherPage" Checked="BrowseAHomePage" GroupName="HomePages">
      XAML Page
        </RadioButton>
        <Frame Name = "myFrame" Background="LightBlue"/>
    </StackPanel>
</Page>

//File:Window.xaml.cs

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Input;
using System.IO;
using System.Net;

namespace FrameExample
{
  public partial class Page1 : Page
  {
    private void BrowseAHomePage(object sender, RoutedEventArgs e)
    {
      if ((Boolean)VisualBasic.IsChecked)
        myFrame.Navigate(new System.Uri("http://msdn.microsoft.com/vbasic/")); 
      else if ((Boolean)VisualCSharp.IsChecked)
        myFrame.Navigate(new System.Uri("http://msdn.microsoft.com/vcsharp/")); 
      else if ((Boolean)AnotherPage.IsChecked)
        myFrame.Navigate(new System.Uri("AnotherPage.xaml",UriKind.RelativeOrAbsolute));
     }
  }
}

   
    
     


Xaml frame on a Tab


   
       
<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="Microsoft.Samples.Graphics.UsingVisualBrush.SampleViewer"
    Title="VisualBrush Sample">

  <DockPanel Background="White">
  
    <TabControl Name="sampleSelector" Background="White" BorderBrush="Orange">

      <TabItem Header="Painting with Visuals" >
        <Frame Source="PaintingWithVisuals.xaml" Background="White" />            
      </TabItem>
      <TabItem Header="Magnifying Glass Example" >
        <Frame Source="MagnifyingGlassExample.xaml" Background="White" />            
      </TabItem>     
      <TabItem Header="Reflection Example" >
        <Frame Source="ReflectionExample.xaml" Background="White" />            
      </TabItem>       
    </TabControl> 
  </DockPanel>


</Window>

   
    
    
    
    
    
    
     


Use Frame to Load another Xaml file

   
    

<Window x:Class="SimpleStyles.Window1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="SimpleStyles"
  Background="#F8F8F8">
  <ScrollViewer>
    <WrapPanel>
      <HeaderedItemsControl Header="Frame">
        <StackPanel>
          <Frame Source="page1.xaml" Width="200" Height="200"/>
        </StackPanel>
      </HeaderedItemsControl>
   
    </WrapPanel>
  </ScrollViewer>
</Window>

   
    
    
    
     


Use the IsSharedSizeScope attached property of the Grid element


   
  

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="WpfApplication1.Window1"
    Title="Grid IsSharedSizeScope Sample">
    <Border BorderBrush="Black" Background="White" BorderThickness="2">

  <DockPanel Name="dp1" Grid.IsSharedSizeScope="False" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10">
    <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">  
        <Button Click="setTrue" Margin="0,0,10,10">Set IsSharedSizeScope="True"</Button>
        <Button Click="setFalse" Margin="0,0,10,10">Set IsSharedSizeScope="False"</Button>
    </StackPanel> 

    <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
 
    <Grid ShowGridLines="True" Margin="0,0,10,0">
      <Grid.ColumnDefinitions>
        <ColumnDefinition SharedSizeGroup="FirstColumn"/>
        <ColumnDefinition SharedSizeGroup="SecondColumn"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" SharedSizeGroup="FirstRow"/>
      </Grid.RowDefinitions>
        <Rectangle Fill="Silver" Grid.Column="0" Grid.Row="0" Width="200" Height="100"/>
        <Rectangle Fill="Blue" Grid.Column="1" Grid.Row="0" Width="150" Height="100"/>

        <TextBlock Grid.Column="0" Grid.Row="0" FontWeight="Bold">First Column</TextBlock>
        <TextBlock Grid.Column="1" Grid.Row="0" FontWeight="Bold">Second Column</TextBlock>
    </Grid>

    <Grid ShowGridLines="True">
      <Grid.ColumnDefinitions>
        <ColumnDefinition SharedSizeGroup="FirstColumn"/>
        <ColumnDefinition SharedSizeGroup="SecondColumn"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>        
        <RowDefinition Height="Auto" SharedSizeGroup="FirstRow"/>
      </Grid.RowDefinitions>

        <Rectangle Fill="Silver" Grid.Column="0" Grid.Row="0"/>
        <Rectangle Fill="Blue" Grid.Column="1" Grid.Row="0"/>
 
        <TextBlock Grid.Column="0" Grid.Row="0" FontWeight="Bold">First Column</TextBlock>
        <TextBlock Grid.Column="1" Grid.Row="0" FontWeight="Bold">Second Column</TextBlock>
    </Grid>
    
    </StackPanel>

  </DockPanel>
  </Border>  
</Window>

//File:Window.xaml.cs

using System;
using System.Windows;
using System.Windows.Controls;

namespace WpfApplication1
{
  public partial class Window1 : Window
  {
        public void setTrue(object sender, System.Windows.RoutedEventArgs e)
        {
            Grid.SetIsSharedSizeScope(dp1, true);
            Console.WriteLine(Grid.GetIsSharedSizeScope(dp1).ToString());
        }

        public void setFalse(object sender, System.Windows.RoutedEventArgs e)
        {
            Grid.SetIsSharedSizeScope(dp1, false);
            Console.WriteLine(Grid.GetIsSharedSizeScope(dp1).ToString());
        }
  }
}

   
    
     


Add the PropertyGrid to the host, and the host to the WPF Grid


   
  

<Window x:Class="WpfApplication1.Window1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Hosting a Windows Forms Property Grid in WPF"
  Loaded="Window_Loaded">
    <Grid Name="grid"/>
</Window>
//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Shapes;

namespace WpfApplication1
{
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.Integration.WindowsFormsHost host =
                new System.Windows.Forms.Integration.WindowsFormsHost();
            System.Windows.Forms.PropertyGrid propertyGrid =
                new System.Windows.Forms.PropertyGrid();

            host.Child = propertyGrid;
            grid.Children.Add(host);
            
            
            propertyGrid.SelectedObject = this;
        }
    }
}

   
    
     


Display a notification icon in the system tray.


   
  


<Window x:Class="NotificationIconSample.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="NotificationIconSample" Height="300" Width="300">
    <Grid>
      <Button Click="click">Click</Button>
    </Grid>
</Window>

//File:Window.xaml.cs
namespace NotificationIconSample
{
    using System;
    using System.Windows;
    using System.Windows.Forms; 
    using System.Drawing;
    public partial class MainWindow : Window
    {
        NotifyIcon notifyIcon;

        public MainWindow()
        {
            InitializeComponent();
        }

        void click(object sender, RoutedEventArgs e)
        {
            this.notifyIcon = new NotifyIcon();
            this.notifyIcon.BalloonTipText = "Hello, NotifyIcon!";
            this.notifyIcon.Text = "Hello, NotifyIcon!";
            this.notifyIcon.Icon = new System.Drawing.Icon("NotifyIcon.ico");
            this.notifyIcon.Visible = true;
            this.notifyIcon.ShowBalloonTip(1000);
        }
    }
}