Intersoft ClientUI Documentation
Columns Property
See Also  Send Feedback
Intersoft.Client.UI.Data Namespace > UXGridView Class : Columns Property






Gets a collection that contains all the columns in the control.

Syntax

Visual Basic (Declaration) 
<CategoryAttribute("Columns")>
Public Property Columns As ObservableCollection(Of UXGridViewColumn)
Visual Basic (Usage)Copy Code
Dim instance As UXGridView
Dim value As ObservableCollection(Of UXGridViewColumn)
 
instance.Columns = value
 
value = instance.Columns
C# 
[CategoryAttribute("Columns")]
public ObservableCollection<UXGridViewColumn> Columns {get; set;}
Delphi 
public read-write property Columns: ObservableCollection; 
JScript 
CategoryAttribute("Columns")
public function get,set Columns : ObservableCollection
Managed Extensions for C++ 
[CategoryAttribute("Columns")]
public: __property ObservableCollection<UXGridViewColumn*>* get_Columns();
public: __property void set_Columns( 
   ObservableCollection<UXGridViewColumn*>* value
);
C++/CLI 
[CategoryAttribute("Columns")]
public:
property ObservableCollection<UXGridViewColumn^>^ Columns {
   ObservableCollection<UXGridViewColumn^>^ get();
   void set (    ObservableCollection<UXGridViewColumn^>^ value);
}

Remarks

By default, the UXGridView control generates columns automatically when you set the ItemsSource property. The generated columns are of type UXGridViewCheckBoxColumn for bound Boolean (and nullable Boolean) properties, and of type UXGridViewTextColumn for all other properties. If a property does not have a string or numeric value type, the generated text box columns are read-only and display the data object's ToString value.

You can prevent automatic column generation by setting the AutoGenerateColumns property to false. This is useful when you want to create and configure all columns explicitly. Alternatively, you can let the data grid generate the columns, but handle the AutoGeneratingColumn event to customize columns after they are instantiated. To rearrange the display order of the columns, you can set the DisplayIndex property to the desired value for each individual column.

Generated columns recognize the DisplayAttribute if it is present on the source object. The DisplayAttribute.ShortName property is used to specify column header text. The DisplayAttribute.Order property is used to specify the order in which columns appear. The DisplayAttribute.AutoGenerateField property is used to specify whether the field has a column generated for it.

Regardless of how you generate the columns, you can access the Columns collection to programmatically add, insert, remove, and change any columns in the control at run time. Alternatively, you can specify columns in XAML, in which case you should set AutoGenerateColumns to false. Creating your own columns enables you to use additional column types, such as the UXGridViewComboBoxColumn, UXGridViewExpanderColumn, UXGridViewSelectColumn, UXGridViewTemplateColumn or other custom column type that inherited from UXGridViewColumn.

The following list describes the built-in column types available in UXGridView.

  • UXGridViewComboBoxColumn type provides an easy way to enable editing using combo box. You can provide the data for the editing combo box through the provided ValueListSource property, and determine the DisplayMemberPath and ValueMemberPath for the display and value object respectively.
    XAML Copy Code
    <Intersoft:UXGridView.Columns>
        <Intersoft:UXGridViewComboBoxColumn Header="Category ID" DisplayMemberPath="CategoryName" ValueMemberPath="CategoryID" Width="120"
                                            Binding="{Binding CategoryID, Converter={StaticResource CategoryConverter}}"                                                         
                                            ValueListSource="{Binding Categories, Source={StaticResource CategoriesViewModel}}"/>                                            
    </Intersoft:UXGridView.Columns>
    


  • UXGridViewExpanderColumn type provides an easy way to expand and collapse a row details if you enable row details in UXGridView.
    XAML Copy Code
    <Intersoft:UXGridView.Columns>
        <Intersoft:UXGridViewExpanderColumn />
        <Intersoft:UXGridViewTextColumn Header="Customer ID" Binding="{Binding CustomerID}"/>
        <Intersoft:UXGridViewTextColumn Header="Contact Name" Binding="{Binding ContactName}"/>
        <Intersoft:UXGridViewTextColumn Header="Contact Title" Binding="{Binding ContactTitle}"/>
        <Intersoft:UXGridViewTextColumn Header="CompanyName" Binding="{Binding CompanyName}"/>
    </Intersoft:UXGridView.Columns>
    


  • UXGridViewSelectColumn type provides an easy way to enable selector column which allows you to check or uncheck a row in UXGridView. The checked items are accessible in the CheckedItems property. This column type also automatically adds a checkbox in the column header, allowing users to easily toggle the checked state of all the rows in the view.
    XAML Copy Code
    <Intersoft:UXGridView.Columns>
        <Intersoft:UXGridViewSelectColumn/>
        <Intersoft:UXGridViewTextColumn Header="Customer ID" Binding="{Binding CustomerID}"/>
        <Intersoft:UXGridViewTextColumn Header="Contact Name" Binding="{Binding ContactName}"/>
        <Intersoft:UXGridViewTextColumn Header="Contact Title" Binding="{Binding ContactTitle}"/>
        <Intersoft:UXGridViewTextColumn Header="CompanyName" Binding="{Binding CompanyName}"/>
    </Intersoft:UXGridView.Columns>
    


  • UXGridViewTemplateColumn type provides full flexibility to create custom columns with specific behaviors that meet your application's requirements. The CellTemplate and CellEditingTemplate properties enable you to specify the content templates for both display and editing mode.
    XAML Copy Code
    <Intersoft:UXGridViewTextColumn Header="Birth Date" Binding="{Binding BirthDate, StringFormat=MM/dd/yyyy}">
        <Intersoft:UXGridViewTextColumn.CellEditingTemplate>
            <DataTemplate>
                <Grid Background="White" Margin="1">
                    <Intersoft:UXDateTimePicker Value="{Binding BirthDate, Mode=TwoWay}" EditMask="MM/dd/yyyy" BorderThickness="0"  
                                            UseEditMaskAsDisplayMask="True" VerticalAlignment="Center" HorizontalAlignment="Stretch"/>
                </Grid>
            </DataTemplate>
        </Intersoft:UXGridViewTextColumn.CellEditingTemplate>
    </Intersoft:UXGridViewTextColumn>
    


The CellTemplate and CellEditingTemplate properties are also available in all built-in column types, allowing you to change the display and editing template for the desired columns.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2012 All Rights Reserved.