2009-07-27 69 views

回答

2

讓我回答這個問題,讓它這樣工作:

代碼:

StackPanel sp = new StackPanel(); 
sp.SetResourceReference(StackPanel.BackgroundProperty, "LeftMenuBackgroundImageBrush"); 
資源

<ImageBrush x:Key="LeftMenuBackgroundImageBrush" 
    ImageSource="{DynamicResource LeftMenuBackgroundImage}"/> 

<ImageSource x:Key="LeftMenuBackgroundImage">Images/LeftMenuBackground.jpg</ImageSource> 
相關問題