Wednesday, March 24, 2010

Background Image of Window or Page in WPF

For Window

< Window x:Class="MyXbap.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300" >
< !-- define Background Property -- >
    < Window.Background >
< !-- Define Image Bruch and Set Image Source to Image Path-- >
     < ImageBrush ImageSource="Beach.jpg" >< /ImageBrush >
    < /Window.Background >
< /Window >


For Page


< Page x:Class="MyXbap.Page2"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:triple="http://thriple.codeplex.com/"
    Title="Page2"  Width="1000" Height="1000" >
< !-- define Backgroudn Property of Page- >
    < Page.Background >
< !-- define Image Brush and Set ImageSource Property -- >
        < ImageBrush ImageSource="Beach.jpg" >< /ImageBrush >
    < /Page.Background >
< /Page >