Version

CheckBoxAlignment Property

Returns or sets the alignment of the checkbox with respect to the remaining item content, i.e., the text and/or the image.
Syntax
'Declaration
 
Public Property CheckBoxAlignment As ContentAlignment
public ContentAlignment CheckBoxAlignment {get; set;}
Example
The following code sample demonstrates how to configure the UltraComboEditor and UltraCombo controls to support "multiple item selection" using the properties of the EditorCheckedListSettings class:

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinEditors
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

Public Class Form1
    Private _table As DataTable

    Public Sub New()

        Me.InitializeComponent()

        '   Bind the UltraComboEditor control to a data source.
        Me.ultraComboEditor1.DisplayMember = "Display"
        Me.ultraComboEditor1.ValueMember = "Value"
        Me.ultraComboEditor1.DataSource = Me.Table

        '   Bind the UltraCombo control to a data source.
        Me.ultraCombo1.DisplayMember = "Display"
        Me.ultraCombo1.ValueMember = "Value"
        Me.ultraCombo1.DataSource = Me.Table

    End Sub

    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
        MyBase.OnLoad(e)

        '  Set up the UltraComboEditor to show checkboxes next to the items, with middle-left alignment
        Me.ultraComboEditor1.CheckedListSettings.CheckBoxStyle = Infragistics.Win.CheckStyle.CheckBox
        Me.ultraComboEditor1.CheckedListSettings.CheckBoxAlignment = ContentAlignment.MiddleLeft

        '  Set up the UltraCombo to show its checkbox column on the left, with the checkbox middle-center aligned
        Me.ultraCombo1.CheckedListSettings.CheckStateMember = "Selected"
        Dim column As UltraGridColumn = Me.ultraCombo1.DisplayLayout.Bands(0).Columns("Selected")
        Dim checkEditor As CheckEditor = New CheckEditor()
        checkEditor.CheckAlign = ContentAlignment.MiddleCenter
        column.Editor = CheckEditor
        column.Header.VisiblePosition = 0

        '  Set up both controls to get their value from the checked items/rows
        Me.ultraComboEditor1.CheckedListSettings.EditorValueSource = EditorWithComboValueSource.CheckedItems
        Me.ultraCombo1.CheckedListSettings.EditorValueSource = EditorWithComboValueSource.CheckedItems

        '  Set up both controls so that clicking anywhere on the item changes the check state,
        '  and does not close the dropdown until the enter/escape key is pressed
        Me.ultraComboEditor1.CheckedListSettings.ItemCheckArea = ItemCheckArea.Item
        Me.ultraCombo1.CheckedListSettings.ItemCheckArea = ItemCheckArea.Item

        '  Set up both controls to use a custom list delimiter
        Me.ultraComboEditor1.CheckedListSettings.ListSeparator = " / "
        Me.ultraCombo1.CheckedListSettings.ListSeparator = " / "

        '  Handle the ValueChanged event for each control
        AddHandler Me.ultraComboEditor1.ValueChanged, AddressOf Me.OnValueChanged
        AddHandler Me.ultraCombo1.ValueChanged, AddressOf Me.OnValueChanged

    End Sub

    Private Sub OnValueChanged(ByVal sender As Object, ByVal e As EventArgs)

        '  Get the list of values from each control, and a reference
        '  to their IValueList implementation so we can get the text
        '  for each item.
        Dim values As System.Collections.IList = Nothing
        Dim valueList As IValueList = Nothing

        If sender Is Me.ultraComboEditor1 Then
            values = Me.ultraComboEditor1.Value
            valueList = Me.ultraComboEditor1.Items.ValueList

        ElseIf sender Is Me.ultraCombo1 Then
            values = Me.ultraCombo1.Value
            valueList = Me.ultraCombo1
        End If

        '  Iterate the list of values and output each one to the console
        If Not values Is Nothing Then

            Dim index As Int32 = -1

            Dim value As Object
            For Each value In values
                Dim text As String = valueList.GetText(value, index)
                Console.WriteLine(String.Format("Text = '{0}', Value = '{1}'", text, value))
            Next

        End If
    End Sub


    Private ReadOnly Property Table() As DataTable
        Get
            If Me._table Is Nothing Then
                Me._table = New DataTable()
                Me._table.Columns.Add("Value", GetType(Object))
                Me._table.Columns.Add("Display", GetType(String))
                Me._table.Columns.Add("Selected", GetType(Boolean))

                Me._table.Rows.Add(New Object() {1, "One", False})
                Me._table.Rows.Add(New Object() {2, "Two", False})
                Me._table.Rows.Add(New Object() {3, "Three", False})
                Me._table.Rows.Add(New Object() {4, "Four", False})
                Me._table.Rows.Add(New Object() {5, "Five", False})
            End If

            Return Me._table
        End Get
    End Property
End Class
using Infragistics.Win;
using Infragistics.Win.UltraWinEditors;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

public partial class Form1 : Form
{
    private DataTable table = null;

    public Form1()
    {
        this.InitializeComponent();

        //  Bind the UltraComboEditor control to a data source.
        this.ultraComboEditor1.DisplayMember = "Display";
        this.ultraComboEditor1.ValueMember = "Value";
        this.ultraComboEditor1.DataSource = this.Table;

        //  Bind the UltraCombo control to a data source.
        this.ultraCombo1.DisplayMember = "Display";
        this.ultraCombo1.ValueMember = "Value";
        this.ultraCombo1.DataSource = this.Table;
    }

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        //  Set up the UltraComboEditor to show checkboxes next to the items, with middle-left alignment
        this.ultraComboEditor1.CheckedListSettings.CheckBoxStyle = Infragistics.Win.CheckStyle.CheckBox;
        this.ultraComboEditor1.CheckedListSettings.CheckBoxAlignment = ContentAlignment.MiddleLeft;

        //  Set up the UltraCombo to show its checkbox column on the left, with the checkbox middle-center aligned
        this.ultraCombo1.CheckedListSettings.CheckStateMember = "Selected";
        UltraGridColumn column = this.ultraCombo1.DisplayLayout.Bands[0].Columns["Selected"];
        CheckEditor checkEditor = new CheckEditor();
        checkEditor.CheckAlign = ContentAlignment.MiddleCenter;
        column.Editor = checkEditor;
        column.Header.VisiblePosition = 0;

        //  Set up both controls to get their value from the checked items/rows
        this.ultraComboEditor1.CheckedListSettings.EditorValueSource = EditorWithComboValueSource.CheckedItems;
        this.ultraCombo1.CheckedListSettings.EditorValueSource = EditorWithComboValueSource.CheckedItems;

        //  Set up both controls so that clicking anywhere on the item changes the check state,
        //  and does not close the dropdown until the enter/escape key is pressed
        this.ultraComboEditor1.CheckedListSettings.ItemCheckArea = ItemCheckArea.Item;
        this.ultraCombo1.CheckedListSettings.ItemCheckArea = ItemCheckArea.Item;

        //  Set up both controls to use a custom list delimiter
        this.ultraComboEditor1.CheckedListSettings.ListSeparator = " / ";
        this.ultraCombo1.CheckedListSettings.ListSeparator = " / ";

        //  Handle the ValueChanged event for each control
        this.ultraComboEditor1.ValueChanged += new EventHandler(this.OnValueChanged);
        this.ultraCombo1.ValueChanged += new EventHandler(this.OnValueChanged);
    }

    private void OnValueChanged(object sender, EventArgs e)
    {
        //  Get the list of values from each control, and a reference
        //  to their IValueList implementation so we can get the text
        //  for each item.
        System.Collections.IList values = null;
        IValueList valueList = null;

        if ( sender == this.ultraComboEditor1 )
        {
            values = this.ultraComboEditor1.Value as System.Collections.IList;
            valueList = this.ultraComboEditor1.Items.ValueList as IValueList;
        }
        else
        if ( sender == this.ultraCombo1 )
        {
            values = this.ultraCombo1.Value as System.Collections.IList;
            valueList = this.ultraCombo1 as IValueList;
        }

        //  Iterate the list of values and output each one to the console
        if ( values != null )
        {
            int index = -1;

            foreach( object value in values )
            {
                string text = valueList.GetText( value, ref index );
                Console.WriteLine( string.Format("Text = '{0}', Value = '{1}'", text, value) );
            }

        }
    }

    private DataTable Table
    {
        get
        {
            if ( this.table == null )
            {
                this.table = new DataTable();
                this.table.Columns.Add( "Value", typeof(object) );
                this.table.Columns.Add( "Display", typeof(string) );
                this.table.Columns.Add( "Selected", typeof(bool) );

                this.table.Rows.Add( new object[]{ 1, "One", false } );
                this.table.Rows.Add( new object[]{ 2, "Two", false } );
                this.table.Rows.Add( new object[]{ 3, "Three", false } );
                this.table.Rows.Add( new object[]{ 4, "Four", false } );
                this.table.Rows.Add( new object[]{ 5, "Five", false } );
            }

            return this.table;
        }
    }
}
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