I currently define the background for a user control like this:
<UserControl.Background>
<ImageBrush ImageSource="{DynamicResource LeftMenuBackgroundImage}" />
</UserControl.Background>
How can I move this to code-behind, e.g.:
PSEUDO-CODE:
StackPanel sp = new StackPanel();
sp.Background = new ImageBrush(DynamicResource.GetResourceName("LeftMenuBackgroundImage"));