Table of Contents

Class TableViewColumnsCollection

Namespace
WinUI.TableView
Assembly
WinUI.TableView.dll

Represents a collection of TableViewColumn objects used in a TableView.

[WinRTRuntimeClassName("Windows.Foundation.Collections.IObservableVector`1<Microsoft.UI.Xaml.DependencyObject>")]
[WinRTExposedType(typeof(WinUI_TableView_TableViewColumnsCollectionWinRTTypeDetails))]
public class TableViewColumnsCollection : DependencyObjectCollection, IObservableVector<DependencyObject>, IWinRTObject, ITableViewColumnsCollection
Inheritance
object
DependencyObject
DependencyObjectCollection
TableViewColumnsCollection
Implements
IObservableVector<DependencyObject>
IWinRTObject

Remarks

This collection provides functionality for managing columns in a TableView, including adding, removing, and tracking changes to column properties. It supports notifications for collection changes and column property changes, enabling dynamic updates to the TableView.

Constructors

TableViewColumnsCollection(TableView)

The constructor for the TableViewColumnsCollection class.

public TableViewColumnsCollection(TableView tableView)

Parameters

tableView TableView

The TableView that owns this collection.

Properties

TableView

Gets or sets the TableView associated with the collection.

public TableView? TableView { get; }

Property Value

TableView

Remarks

This property allows access to the TableView that owns this collection of columns.

VisibleColumns

Gets the list of visible TableViewColumns.

public IList<TableViewColumn> VisibleColumns { get; }

Property Value

IList<TableViewColumn>

Remarks

The result is a list of columns that are currently visible in the table view, meaning their Visibility is set to Microsoft.UI.Xaml.Visibility.Visible. The result is also ordered by the Order property, allowing for a consistent display order of the columns.

Methods

Move(int, int)

Moves a column from one index to another within the collection.

public void Move(int oldIndex, int newIndex)

Parameters

oldIndex int

The zero-based index of the column to move.

newIndex int

The zero-based index to move the column to.

Events

CollectionChanged

Occurs when the collection changes.

public event NotifyCollectionChangedEventHandler? CollectionChanged

Event Type

NotifyCollectionChangedEventHandler

ColumnPropertyChanged

Occurs when a property of a column changes.

public event EventHandler<TableViewColumnPropertyChangedEventArgs>? ColumnPropertyChanged

Event Type

EventHandler<TableViewColumnPropertyChangedEventArgs>

Remarks

This event is triggered to notify subscribers about changes to column properties, such as width, visibility, or other attributes. Handlers can use the TableViewColumnPropertyChangedEventArgs parameter to access details about the specific property that changed.