Version

GetLabelValueHolder(Field) Method

Returns the Infragistics.Windows.DataPresenter.CellValueHolder whose value is used when putting the field labels into the clipboard.
Syntax
'Declaration
 
Public Overloads Function GetLabelValueHolder( _
   ByVal field As Field _
) As CellValueHolder
public CellValueHolder GetLabelValueHolder( 
   Field field
)

Parameters

field
The field whose Infragistics.Windows.DataPresenter.CellValueHolder is being requested

Return Value

A CellValueHolder or null if the field labels are not going to be included in the clipboard output.
Remarks

When cells are copied to the clipboard, the field labels are optionally included in the output based on the value of the CopyFieldLabelsToClipboard. Using this method, you can provide the text that will be output to the clipboard for a given field. This is useful when the Infragistics.Windows.DataPresenter.FieldItem.Label is set to a non-string value.

Example
The following sample demonstrates how to change the display text that represents a field's label when copied to the clipboard.

Imports Infragistics.Windows.DataPresenter

    Private Sub grid_ClipboardCopying(ByVal sender As System.Object, ByVal e As Infragistics.Windows.DataPresenter.Events.ClipboardCopyingEventArgs)
        For i As Integer = 0 To e.FieldCount - 1
            Dim field As Field = e.GetSourceField(i)
            Dim labelValue As CellValueHolder = e.GetLabelValueHolder(i)

            ' the display uses shortened names for the labels in the 
            ' display but we want to put more verbose descriptions in
            ' the clipboard
            If field.Name = "salary" Then
                labelValue.Value = "Salary"
                labelValue.IsDisplayText = True
            ElseIf field.Name = "department" Then
                labelValue.Value = "Department"
                labelValue.IsDisplayText = True
            End If
        Next
    End Sub
using Infragistics.Windows.DataPresenter;

		private void grid_ClipboardCopying(object sender, Infragistics.Windows.DataPresenter.Events.ClipboardCopyingEventArgs e)
		{
			for (int i = 0; i < e.FieldCount; i++)
			{
				Field field = e.GetSourceField(i);
				CellValueHolder labelValue = e.GetLabelValueHolder(i);

				// the display uses shortened names for the labels in the 
				// display but we want to put more verbose descriptions in
				// the clipboard
				if (field.Name == "salary")
				{
					labelValue.Value = "Salary";
					labelValue.IsDisplayText = true;
				}
				else if (field.Name == "department")
				{
					labelValue.Value = "Department";
					labelValue.IsDisplayText = true;
				}
			}
		}
xmlns:igDP="http://infragistics.com/DataPresenter"

<igDP:XamDataGrid 
    
x:Name="grid" 
    
BindToSampleData="True"
    
ClipboardCopying="grid_ClipboardCopying">
    
<igDP:XamDataGrid.FieldLayoutSettings>
        
<igDP:FieldLayoutSettings 
            
AllowClipboardOperations="All" 
            
CopyFieldLabelsToClipboard="True"/>
    
</igDP:XamDataGrid.FieldLayoutSettings>
    
<igDP:XamDataGrid.FieldLayouts>
        
<igDP:FieldLayout>
            
<igDP:FieldLayout.Fields>
                
<igDP:Field Name="name" Label="Name"/>
                
<igDP:Field Name="salary" Label="$"/>
                
<igDP:Field Name="department" Label="Dept"/>
                
<igDP:Field Name="email" Label="Email"/>
            
</igDP:FieldLayout.Fields>
        
</igDP:FieldLayout>
    
</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, 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