Version

ToolTipText Property

Gets/sets the text that will be displayed in the ToolTip.
Syntax
'Declaration
 
Public Property ToolTipText As String
public string ToolTipText {get; set;}
Remarks

By default, the ToolTipText property will contain the value of of the UltraListViewItemBase.Text property when the ToolTip is being displayed for UltraListViewSubItem, and when the ToolTip is being displayed for an UltraListViewItem when the TipStyle property is set to 'Show'. When the TipStyle property is set to 'Automatic' the value of the UltraListViewItem instance's UltraListViewItemBase.Text property is displayed if it is not fully visible in the user interface. Additionally, the value of the UltraListViewColumnBase.TextResolved property of the UltraListViewSubItemColumn, along with the value of the UltraListViewItemBase.Text property of the corresponding UltraListViewSubItem, is displayed for each of the UltraListViewSubItemColumn instances which are to be displayed as determined by the VisibleInToolTip and SubItemsVisibleInToolTipByDefault properties. The visible order in which the sub-items are displayed is determined by the VisiblePositionInToolTip property.

Example
The following code sample demonstrates how to handle the ToolTipDisplaying event to customize the tooltip that appears when the cursor hovers over an UltraListViewItem:

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinListView

	 '	Show tooltips for items whether the value is fully visible or not
    Me.ultraListView1.ItemSettings.TipStyle = ItemTipStyle.ShowAlways
    Me.ultraListView1.ViewSettingsDetails.SubItemTipStyle = SubItemTipStyle.ShowIfNeeded

    Private Sub ultraListView1_ToolTipDisplaying(ByVal sender As Object, ByVal e As ToolTipDisplayingEventArgs) Handles lvwFiles.ToolTipDisplaying

        '	Override the default tooltip behavior for folder items,
        '	so we can display a summary of the contents of the folder
        '	when the end user hovers over the item.
        If (e.IsToolTipForSubItem) Then Return

        Dim item As UltraListViewItem = e.Item

        Dim directoryInfo As directoryInfo = Nothing
        If item.Tag.GetType() Is GetType(directoryInfo) Then directoryInfo = CType(item.Tag, directoryInfo)

        If (Not directoryInfo Is Nothing) Then

            Dim sb As StringBuilder = New StringBuilder()
            Dim directories As directoryInfo() = directoryInfo.GetDirectories()
            Dim files As FileInfo() = directoryInfo.GetFiles()

            Dim limiter As Integer = 0
            Dim i As Integer

            If (directories.Length = 0 AndAlso files.Length = 0) Then
                sb.Append("Folder is empty")
            ElseIf (directories.Length > 0) Then

                sb.Append(directoryInfo.Name)
                sb.Append(Environment.NewLine)
                sb.Append("Folders: ")
                sb.Append(Environment.NewLine)

                limiter = Math.Min(5, directories.Length - 1)
                For i = 0 To limiter
                    sb.Append(directories(i).Name)
                    If (i < limiter) Then sb.Append(", ")
                Next

                If (limiter < (directories.Length - 1)) Then sb.Append("...")

            ElseIf (files.Length > 0) Then

                sb.Append(directoryInfo.Name)
                sb.Append(Environment.NewLine)
                sb.Append("Files: ")
                sb.Append(Environment.NewLine)

                limiter = Math.Min(5, files.Length - 1)
                For i = 0 To limiter
                    sb.Append(files(i).Name)
                    If (i < limiter) Then sb.Append(", ")
                Next

                If (limiter < (files.Length - 1)) Then
                    sb.Append("...")
                End If
            End If

            e.ToolTipText = sb.ToString()
        End If
    End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinListView;
using System.Diagnostics;

		//	Show tooltips for items whether the value is fully visible or not
		this.ultraListView1.ItemSettings.TipStyle = ItemTipStyle.ShowAlways;
		this.ultraListView1.ViewSettingsDetails.SubItemTipStyle = SubItemTipStyle.ShowIfNeeded;

		private void ultraListView1_ToolTipDisplaying(object sender, Infragistics.Win.UltraWinListView.ToolTipDisplayingEventArgs e)
		{
			//	Override the default tooltip behavior for folder items,
			//	so we can display a summary of the contents of the folder
			//	when the end user hovers over the item.
			if ( e.IsToolTipForSubItem )
				return;

			UltraListViewItem item = e.Item;
			DirectoryInfo directoryInfo = item.Tag as DirectoryInfo;
			if ( directoryInfo != null )
			{
				StringBuilder sb = new StringBuilder();
				DirectoryInfo[] directories = directoryInfo.GetDirectories();
				FileInfo[] files = directoryInfo.GetFiles();
				int limiter = 0;

				if ( directories.Length == 0 && files.Length == 0 )
					sb.Append( "Folder is empty" );
				else
				if ( directories.Length > 0 )
				{
					sb.Append( directoryInfo.Name );
					sb.Append( Environment.NewLine );
					sb.Append( "Folders: " );
					sb.Append( Environment.NewLine );

					limiter = Math.Min( 5, directories.Length - 1 );
					for ( int i = 0; i <= limiter; i ++ )
					{
						sb.Append( directories[i].Name );
						if ( i < limiter )
							sb.Append( ", " );
					}

					if ( limiter < (directories.Length - 1) )
						sb.Append( "..." );
				}
				else
				if ( files.Length > 0 )
				{
					sb.Append( directoryInfo.Name );
					sb.Append( Environment.NewLine );
					sb.Append( "Files: " );
					sb.Append( Environment.NewLine );

					limiter = Math.Min( 5, files.Length - 1 );
					for ( int i = 0; i <= limiter; i ++ )
					{
						sb.Append( files[i].Name );
						if ( i < limiter )
							sb.Append( ", " );
					}

					if ( limiter < (files.Length - 1) )
						sb.Append( "..." );
				}


				e.ToolTipText = sb.ToString();
			}
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also