Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Silverlight
 Render Method
Collapse All/Expand All Collapse All
.NET Framework Class Library for Silverlight
WriteableBitmap..::.Render Method

Renders an element within the bitmap.

Namespace:  System.Windows.Media.Imaging
Assembly:  System.Windows (in System.Windows.dll)
Visual Basic (Declaration)
Public Sub Render ( _
    element As UIElement, _
    transform As Transform _
)
C#
public void Render(
    UIElement element,
    Transform transform
)

Parameters

element
Type: System.Windows..::.UIElement
The element to be rendered within the bitmap.
transform
Type: System.Windows.Media..::.Transform
The transform to apply to the element before drawing into the bitmap. If an empty transform is supplied, the bits representing the element show up at the same offset as if they were placed within their parent.
ExceptionCondition
ArgumentNullException

element is null.

After calling this method, you must call Invalidate in order to render the bitmap.

This method does support UIElement objects that are not part of the visual tree. You are required to call Measure and Arrange for UIElement objects that are not in the visual tree, before calling Render.

If the element is larger than the size of the bitmap, or if the element has any points in the negative regions of its own space, it is clipped as appropriate.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Kindof works...      michael.newcomb   |   Edit   |   Show History
This method kindof works, but it depends on measure and arrange working properly. I have found that measure and arrange are not reliable when not called by the ui thread (or whatever thread normally calls them). $0$0 $0 $0I have a custom control that renders other controls to bitmaps, then blits them to my custom control. I can't just add the componnets, because it slows the ui down to a crawl... but if I just blit the componets, it is blazing fast. However, my controls do not always arrange/measure properly when I call measure/arrange. I have to call measure/arrange when the main control is measured/arranged or my controls won't attain the correct size.$0 $0$0 $0 $0I would caveat the claim that this method can render controls not on the visual tree, well, because the controls can never be reliably measured/arranged without happening on some undefined ui thread...$0
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker