DependencyObjectExtensionsSafeTransformToVisual Method Document Toolkit Help
Safely returns a transform object. Returns null a transform object could not be created.

Namespace: FirstFloor.Documents
Assembly: FirstFloor.Documents (in FirstFloor.Documents.dll) Version: (

public static GeneralTransform SafeTransformToVisual(
	this UIElement element,
	UIElement visual


Type: System.WindowsUIElement
The element.
Type: System.WindowsUIElement
The visual.

Return Value

Type: GeneralTransform
The transform information as an object.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type UIElement. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

This method avoids the dreaded ArgumentException when both elements are not in the same visual tree or the layout has not been updated yet.
See Also