将stackpanel的背景设置为c#中的图像

Ame*_*een 3 windows-phone-7

我需要的设定背景的StackPanel在资源一定的图像.
我知道我应该设置背景如下:

Stack.Background= image; // don't know of what type the image should be how to set it   
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏,

Ric*_*ins 5

string fileName = "/Background.png";
BitmapImage image = new BitmapImage(new Uri(fileName, UriKind.Relative));
ImageBrush brush = new ImageBrush();
brush.ImageSource = image;
stack.Background = brush;
Run Code Online (Sandbox Code Playgroud)