loadcomponent

How to render a usercontrol loaded via LoadComponent to a bitmap/image in WPF?

I'm trying something along these lines. //Somewhere in my app System.Uri resourceLocater = new System.Uri("/MyApp;component/Users.xaml", System.UriKind.Relative); var obj = Application.LoadComponent(resourceLocater); //Invoke the renderxaml element var image=RenderXamlElement(obj as UserControl); //Then I may save this image to a fil...