Special Node Features
In addition to common node features, child nodes may have one or more special features, depending on circumstances or requirements. All special node features are optional; they include the following:
Node Icons
Conditionally Hiding Nodes
Properties
Commands
Node Icons
Static nodes and selection nodes can specify an icon to display in Server Explorer next to their node name. Therefore, these nodes can contain zero or more Icon elements specifying icons they want to display under different conditions. The Icon elements themselves can identify an icon from a standard set, or a custom icon in a managed resource.
注意
Connection node icons are defined and controlled by Visual Studio.
Furthermore, in the same manner in which display names can be applied conditionally, a when attribute on the Icon element allows you to provide various icons for a node conditionally.
An example of how this is useful involves a data view for a SQL Server database, where the type of icon for each function node depends on whether it is a scalar-valued or table-valued function. The XML definition of this data view cannot know what kinds it will include for a given selection of functions, so it can specify only a range of possible icons and the circumstances under which each one should be displayed.
For this example, something like the following XML might provide this functionality:
<SelectionNode>
<Icon when="FunctionType =1" name="ScalarFunction"/>
<Icon when="FunctionType =2" name="TableFunction"/>
</SelectionNode>
Conditionally Hiding Nodes
Static nodes and selection nodes can specify a condition under which they should not be displayed, or remain hidden. You can specify that a node remain hidden using a skipWhen attribute; this attribute contains an expression that is evaluated at run time to determine whether the node should be displayed.
For example, you could use this feature to display or hide folders under a given database object dynamically based on whether they are system objects.
Properties
You can specify a set of properties for all types of nodes. These properties will be displayed in the Visual Studio property grid when a node is selected. The property value for each property can be specified in the DataViewSupport XML, or, if it is not found in the XML, its value is retrieved from the node object.
Commands
You can apply commands for static nodes and object nodes in the data view. The commands can serve the purpose of opening the content of a node, designing a node, deleting a node, or adding new objects.