Click or drag to resize
AB4D logo

ExtensionsSetName(Visual3D, String) Method

Sets Name property to Visual3D. Note that if name is not correct for WPF, it can be corrected (name must start with a letter or the underscore character (_), and must contain only letters, digits, or underscores). In this case the SetName method will set the corrected name to the object and return false (in this case you can call GetName to get the corrected name). True is returned when the original name is set to the object.

Namespace: Ab3d
Assembly: Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 11.1.8864.1045
Syntax
C#
public static bool SetName(
	this Visual3D visual3D,
	string name
)

Parameters

visual3D  Visual3D
Visual3D
name  String
name

Return Value

Boolean
returns true if name was set without correcting it to comply with WPF name regulations; returns false if name was corrected

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Visual3D. 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).
Remarks

Sets Name property to Visual3D.

Note that if name is not correct for WPF, it can be corrected (name must start with a letter or the underscore character (_), and must contain only letters, digits, or underscores). In this case the SetName method will set the corrected name to the object and return false (in this case you can call GetName to get the corrected name). True is returned when the original name is set to the object.

Though many objects in WPF does not have Name property (with public Name getters and setters), it is still possible to set value for the Name property with using a SetValue method on DependencyObjects:

C#
dependencyObjects.SetValue(FrameworkElement.NameProperty, name);

The value of the Name can than be read with:

C#
return dependencyObjects.GetValue(FrameworkElement.NameProperty) as string;

The SetName and GetName extension methods simplify setting the values on commonly used 3D objects.

See Also