バージョン

LabelTextWrapping プロパティ (FieldSettings)

テキストを一行に表示するために十分な幅がない場合、LabelPresenter 内でテキストをどのように折り返すのかを決定します。
シンタックス
'宣言
 
Public Property LabelTextWrapping As Nullable(Of TextWrapping)
public Nullable<TextWrapping> LabelTextWrapping {get; set;}
解説

注: この設定は、FieldLabel が文字列で、LabelPresenter の ContentTemplate プロパティが設定されていない場合にのみ適用されます。

使用例
The folllowing shows how to specify default settings for label text allignment, trimming and wrapping as well as how to override those settings for a specific field based on its data type.
public partial class Window2 : Window
{
    public Window2()
    {
        InitializeComponent();

        // Set the default label text alignment, trimming and wrapping settings
        this.XamDataGrid1.FieldSettings.LabelTextAlignment = TextAlignment.Left;
        this.XamDataGrid1.FieldSettings.LabelTextTrimming = TextTrimming.CharacterEllipsis;
        this.XamDataGrid1.FieldSettings.LabelTextWrapping = TextWrapping.Wrap;

        // wire up the FieldLayoutInitialized event to override the
        // text alignment based on the data type of the field
        this.XamDataGrid1.FieldLayoutInitialized += new EventHandler<Infragistics.Windows.DataPresenter.Events.FieldLayoutInitializedEventArgs>(OnFieldLayoutInitialized);
    }

    void OnFieldLayoutInitialized(object sender, FieldLayoutInitializedEventArgs e)
    {
        foreach (Field field in e.FieldLayout.Fields)
        {
            // If the type is numeric then align the label on the right
            Type dataType = field.DataType;
            if (dataType == typeof(double) ||
                dataType == typeof(float) ||
                dataType == typeof(int) ||
                dataType == typeof(decimal))
                field.Settings.LabelTextAlignment = TextAlignment.Right;
        }
    }
}
The folllowing shows how to specify default settings for label text allignment, trimming and wrapping as well as how to override those settings for a specific field.
<Window x:Class="Snippet_app_1.Window2"
    
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    
xmlns:igDP="http://infragistics.com/DataPresenter"
    
xmlns:igEditors="http://infragistics.com/Editors"
    
xmlns:igWindows="http://infragistics.com/Windows"
    
xmlns:igThemes="http://infragistics.com/Themes"
    
Title="Window2" Height="300" Width="300">
    
<Grid>
        
<igDP:XamDataGrid x:Name="XamDataGrid1">
            
<!-- These settings become the default for all Fields -->
            
<igDP:XamDataGrid.FieldSettings>
                
<!-- Set the default label text alignment, trimming
                     and wrapping settings
-->
                
<igDP:FieldSettings LabelTextAlignment="Left" 
                                    
LabelTextTrimming="WordEllipsis" 
                                    
LabelTextWrapping="Wrap"/>
            
</igDP:XamDataGrid.FieldSettings>
            
<igDP:XamDataGrid.FieldLayouts>
                
<igDP:FieldLayout>
                    
<igDP:FieldLayout.Fields>
                         
<igDP:Field Name="Price" Label="Unit Price">
                            
<!-- Set the label text alignment, trimming
                                 and wrapping settings for the 'Price' field
-->
                            
<igDP:Field.Settings>
                                
<igDP:FieldSettings 
                                    
LabelTextAlignment="Right" 
                                    
LabelTextTrimming="CharacterEllipsis" 
                                    
LabelTextWrapping="NoWrap"/>
                            
</igDP:Field.Settings>
                        
</igDP:Field>
                    
</igDP:FieldLayout.Fields>
                
</igDP:FieldLayout>
            
</igDP:XamDataGrid.FieldLayouts>
        
</igDP:XamDataGrid>

    
</Grid>
</Window>
The folllowing shows how to specify default settings for label text allignment, trimming and wrapping as well as how to override those settings for a specific field based on its data type.
Imports Infragistics.Windows.DataPresenter

Partial Public Class Window2

    Public Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()


        ' Set the default label text alignment, trimming and wrapping settings
        Me.XamDataGrid1.FieldSettings.LabelTextAlignment = TextAlignment.Left
        Me.XamDataGrid1.FieldSettings.LabelTextTrimming = TextTrimming.CharacterEllipsis
        Me.XamDataGrid1.FieldSettings.LabelTextWrapping = TextWrapping.Wrap

    End Sub

    Private Sub XamDataGrid1_FieldLayoutInitialized(ByVal sender As Object, ByVal e As Infragistics.Windows.DataPresenter.Events.FieldLayoutInitializedEventArgs) Handles XamDataGrid1.FieldLayoutInitialized
        Dim datatype As Type
        For Each fld As Field In e.FieldLayout.Fields

            ' If the type is numeric then align the label on the right
            datatype = fld.DataType
            If (datatype Is GetType(Integer) OrElse _
                datatype Is GetType(Double) OrElse _
                datatype Is GetType(Single) OrElse _
                datatype Is GetType(Decimal)) Then
                fld.Settings.LabelTextAlignment = TextAlignment.Right
            End If

        Next
    End Sub
End Class
参照