Skip to content
OpenAgentSkill
Browsing is open · Catalog captured 2026-11-21 · Automatic updates and account services are paused.
Other skills

avalonia-controls-data-display

Use when working with Avalonia data display controls: TextBlock, Label, ItemsControl, ListBox, TableView (12.1+), DataGrid (maintenance mode), TreeDataGrid (commercial), TreeView, or Carousel. Includes a decision table for choosing a list/grid control, compiled-binding rules for DataGrid/TableView columns, touch/pen selection behavior, and Carousel swipe/wrap (12.0+). Note there is no built-in MarkdownViewer; use Markdown.Avalonia. Covers Avalonia 11.3, 12.0 and 12.1.

linuxdevel · Static checks on file

Installation

Read the source and dependencies before running a command. Copying does not install or execute anything.

npx skills add linuxdevel/Avalonia-skills --skill avalonia-controls-data-display

About this skill


name: avalonia-controls-data-display description: Use when working with Avalonia data display controls: TextBlock, Label, ItemsControl, ListBox, TableView (12.1+), DataGrid (maintenance mode), TreeDataGrid (commercial), TreeView, or Carousel. Includes a decision table for choosing a list/grid control, compiled-binding rules for DataGrid/TableView columns, touch/pen selection behavior, and Carousel swipe/wrap (12.0+). Note there is no built-in MarkdownViewer; use Markdown.Avalonia. Covers Avalonia 11.3, 12.0 and 12.1.

Avalonia Data Display Controls

Overview

Data display controls render read-only or selectable information. Pick by need:

NeedControlAvailability
Simple repeated items, no selectionItemsControlall
Selectable list, custom item layoutListBoxall
Read-only table: columns over a collection, no editing (virtualized, row/cell recycling)TableView12.1+ (core Avalonia package)
Editable/sortable/grouped gridDataGridAvalonia.Controls.DataGrid package, MIT. Maintenance mode (bug fixes only) since 12.1 — fine for existing apps and 11.x/12.0, don't pick for new read-only grids on 12.1+
Tree + table, advanced editing, hierarchical gridTreeDataGridAvalonia.Controls.TreeDataGrid package. Commercial: requires an Avalonia Accelerate/Pro license (since 11.2); versions independently (12.x line targets Avalonia 12)
Hierarchy, single columnTreeViewall

There is no MarkdownViewer in Avalonia core. Use the community Markdown.Avalonia package (or LiveMarkdown.Avalonia).


TextBlock

PropertyTypeNotes
TextstringPlain text content
FontSizedoubleIn device-independent pixels
FontWeightFontWeightNormal, Bold, SemiBold, etc.
FontStyleFontStyleNormal, Italic, Oblique
TextWrappingTextWrappingNoWrap, Wrap, WrapWithOverflow
TextTrimmingTextTrimmingNone, CharacterEllipsis, WordEllipsis
TextDecorationsTextDecorationCollectionUnderline, Strikethrough
LineHeightdoubleLine spacing
MaxLinesintClamps number of displayed lines
InlinesInlineCollectionMixed-format inline content
<!-- Basic -->
<TextBlock Text="{Binding Title}" FontSize="18" FontWeight="SemiBold"/>

<!-- Trimming with ellipsis -->
<TextBlock Text="{Binding Description}" TextTrimming="CharacterEllipsis" MaxWidth="300"/>

<!-- Inline formatting -->
<TextBlock>
    <Run FontWeight="Bold">Important:</Run>
    <Run> This is </Run>
    <Run Foreground="Red" FontStyle="Italic">critical</Run>
    <LineBreak/>
    <Run Text="{Binding Detail}"/>
</TextBlock>

<!-- Underline + strikethrough -->
<TextBlock Text="Strike me" TextDecorations="Strikethrough"/>
<TextBlock Text="Link-style" TextDecorations="Underline" Cursor="Hand"/>

Label

PropertyTypeNotes
ContentobjectText or XAML content
TargetIInputElementAssociates access key with target control

Use _ prefix in content to define an access key (Alt+key focuses Target).

<Label Content="_Username" Target="{Binding #usernameBox}"/>
<TextBox x:Name="usernameBox" Text="{Binding Username}"/>

<Label Content="_Password" Target="{Binding #passwordBox}"/>
<TextBox x:Name="passwordBox" PasswordChar="•" Text="{Binding Password}"/>

Note: Label adds padding and is a ContentControl. For pure display, prefer TextBlock.


ItemsControl

Base class for all list controls. Use directly when no selection is needed.

PropertyTypeNotes
ItemsSourceIEnumerableBound collection
ItemTemplateDataTemplateTemplate for each item
ItemsPanelItemsPanelTemplateLayout panel (default: StackPanel)
ItemContainerThemeControlThemeStyle for each container
<!-- Simple read-only list -->
<ItemsControl ItemsSource="{Binding Tags}">
    <ItemsControl.ItemTemplate>
        <DataTemplate x:DataType="vm:TagVm">
            <Border Background="#E3F2FD" CornerRadius="4" Padding="8,4" Margin="0,0,4,4">
                <TextBlock Text="{Binding Name}" FontSize="12"/>
            </Border>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
    <!-- Horizontal wrapping layout -->
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <WrapPanel Orientation="Horizontal"/>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
</ItemsControl>

ListBox

Extends ItemsControl with selection. Virtualizes items by default.

PropertyTypeNotes
SelectedItemobjectTwoWay by default
SelectedItemsIListMultiple selection (requires SelectionMode flag)
SelectedIndexintZero-based index
SelectionModeSelectionModeSingle, Multiple, Toggle, AlwaysSelected
ScrollScrollViewerAccess the internal scroll viewer

12.0+ behavior: touch/pen selection happens on pointer release (swipe/scroll no longer selects). ListBoxItem and TreeViewItem handle selection themselves — to customize, override ShouldTriggerSelection / UpdateSelectionFromEvent rather than intercepting at the ListBox/TreeView level. UpdateSelection / UpdateSelectionFromEventSource are obsolete.

<ListBox ItemsSource="{Binding People}"
         SelectedItem="{Binding SelectedPerson}"
         SelectionMode="Single">
    <ListBox.ItemTemplate>
        <DataTemplate x:DataType="vm:PersonVm">
            <StackPanel Margin="4">
                <TextBlock Text="{Binding FullName}" FontWeight="SemiBold"/>
                <TextBlock Text="{Binding Email}" FontSize="12" Foreground="Gray"/>
            </StackPanel>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

<!-- Multi-select -->
<ListBox ItemsSource="{Binding Files}"
 
Read the complete source ↗