|
ExtensionsSetName(Material, String) Method |
Sets Name property to Material. 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: Ab3dAssembly: Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 11.2.9104.2045
Syntax public static bool SetName(
this Material material,
string name
)
Parameters
- material Material
- Material
- name String
- name
Return Value
Booleanreturns 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
Material. 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 Material.
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:
dependencyObjects.SetValue(FrameworkElement.NameProperty, name);
The value of the Name can than be read with:
return dependencyObjects.GetValue(FrameworkElement.NameProperty) as string;
The SetName and GetName extension methods simplify setting the values on commonly used 3D objects.
See Also