Aracılığıyla paylaş


ToolTip Element (IntelliSense Code Snippets)

Describes the expected value and usage of a literal or object in a code snippet, which Visual Studio displays in a ToolTip when it inserts the code snippet into a project.

<CodeSnippets>
  <CodeSnippet>
    <Snippet>
      <Declarations>
        <Literal>
          <ToolTip>
            <Object>
              <ToolTip>

<ToolTip>
    ToolTip description
</ToolTip>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

None.

Child Elements

None.

Parent Elements

Element

Description

Literal

Defines the literal fields of the code snippet that you can edit.

Object

Defines the object fields of the code snippet that you can edit.

Text Value

A text value is required.

This text specifies the ToolTip description to be associated with the object or literal in the code snippet.

Remarks

The ToolTip text is displayed when the mouse hovers over the literal or object after the code snippet has been inserted.

Example

The following example shows how to declare ToolTip elements for Literal and Object elements.

<CodeSnippets xmlns="https://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <!-- Insert Header information here. -->
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>SQL</ID>
                    <ToolTip>Replace with a SQL connection string.</ToolTip>
                    <Default>"SQL connection string"</Default>
                </Literal>
                <Object>
                    <ID>Connection</ID>
                    <Type>System.Data.SqlClient.SqlConnection</Type>
                    <ToolTip>Replace with a connection object in your application.</ToolTip>
                    <Default>dcConnection</Default>
                </Object>
            </Declarations>
            <Code Language="CSharp">
                <!-- Insert code here. -->
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

See Also

Concepts

Code Snippets Schema Reference