Background Image of Window or Page in WPF

Background Image of Window or Page in WPF



This Code Snippet produce Background Image of Window or Page



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 >



Note:- Make Sure Image Property Copy to Image Directory to Copy always


Attachments

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: