Friday, January 06, 2012

How can I use a image background in WPF?

Posted by Rahul Kharde at 4:16 AM

To set an image as background of WPF Browser page, we can set an image as the Background of the Page and Grid. The following code snippet sets the background of a Grid to an image.

Also we can set the opacity of the image.

<Page x:Class="WPF.PageBackgroundImage"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

Title="Page Backround" Width="325" Height="208">

<Page.Background>

<ImageBrush ImageSource="Image/Water lilies.jpg" Opacity="0.2"/>

</Page.Background>

<Grid>

<TextBlock Margin="16,78,0,58">

Image are set in background of Page in WPF

</TextBlock>

</Grid>

</Page>

Output




If you enjoyed this post and wish to be informed whenever a new post is published, then make sure you subscribe to my regular Email Updates. Subscribe Now!


Kindly Bookmark and Share it:

YOUR ADSENSE CODE GOES HERE

0 comments:

Have any question? Feel Free To Post Below:

 

Popular Posts

Recent Comments

© 2011. All Rights Reserved | Help to understand .Net | Template by Blogger Widgets

Home | About | Top