Click or drag to resize
AB4D logo

ExtensionsSetName(Model3D, String) Method

Sets Name property to Model3D. 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.2.9104.2045
Syntax
C#
public static bool SetName(
	this Model3D model3D,
	string name
)

Parameters

model3D  Model3D
Model3D
name  String
if true, the name will be corrected if not valid for WPF 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 Model3D. 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 Model3D.

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