A property to associate data with an item.
[Visual Basic .NET] Public Property CustomProperty As Object
[C#] public object CustomProperty {get; set;}
[C++]
HRESULT get_CustomProperty(
VARIANT* pVal
);
[C++]
HRESULT put_CustomProperty(
VARIANT pVal
);
[C++]Parameters
pVal [out, retval] pVal is a parameter of type VARIANT pVal [in] pVal is a parameter of type VARIANT
Product Availability
Available with ArcGIS Engine.
Description
Use the CustomProperty to associate any useful data with the ToolbarItem. This is similar to a 'Tag' property, and can be use to store strings, numbers and objects.
[C#]
//To set a custom property
IToolbarItem toolbarItem = axToolbarControl1.GetItem(0);
toolbarItem.CustomProperty = layer;
//To get a custom property
IToolbarItem toolbarItem = axToolbarControl1.GetItem(0);
if (toolbarItem.CustomProperty is ILayer)
{
ILayer layer = (ILayer) toolbarItem.CustomProperty;
System.Windows.Forms.MessageBox.Show(layer.Name);
}
[Visual Basic .NET]
'To set a custom property
Dim pToolbarItem As IToolbarItem
pToolbarItem = AxToolbarControl1.GetItem(0)
pToolbarItem.CustomProperty = pLayer
'To get a custom property
Dim pToolbarItem As IToolbarItem
pToolbarItem = AxToolbarControl1.GetItem(0)
If TypeOf pToolbarItem.CustomProperty Is ILayer Then
'Dim pLayer As ILayer
pLayer = pToolbarItem.CustomProperty
System.Windows.Forms.MessageBox.Show(pLayer.Name)
End If