Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wieslawsoltes/TreeDataGridEx

TreeDataGridEx is an experimental version of TreeDataGrid for Avalonia with added XAML syntax.
https://github.com/wieslawsoltes/TreeDataGridEx

avalonia avaloniaui datagrid treedatagrid xaml

Last synced: about 2 months ago
JSON representation

TreeDataGridEx is an experimental version of TreeDataGrid for Avalonia with added XAML syntax.

Awesome Lists containing this project

README

        

# TreeDataGridEx

[![CI](https://github.com/wieslawsoltes/TreeDataGridEx/actions/workflows/build.yml/badge.svg)](https://github.com/wieslawsoltes/TreeDataGridEx/actions/workflows/build.yml)

[![NuGet](https://img.shields.io/nuget/v/TreeDataGridEx.svg)](https://www.nuget.org/packages/TreeDataGridEx)
[![NuGet](https://img.shields.io/nuget/dt/TreeDataGridEx.svg)](https://www.nuget.org/packages/TreeDataGridEx)

**TreeDataGridEx** is an experimental version of [TreeDataGrid](https://github.com/AvaloniaUI/Avalonia.Controls.TreeDataGrid) for [Avalonia](https://github.com/AvaloniaUI/Avalonia) with added XAML syntax.

![image](https://github.com/wieslawsoltes/TreeDataGridEx/assets/2297442/cd6d9484-3707-40a7-b012-e0d58966c406)

## Usage

_**Warning:** Please note that the TreeDataGridEx control uses reflection so it might cause issues when using AOT compilation or trimming._

### NuGet

TreeDataGridEx is delivered as a NuGet package.

You can find the packages here [NuGet](https://www.nuget.org/packages/TreeDataGridEx/) and install the package like this:

`Install-Package TreeDataGridEx`

### Styles

Add styles to `App.axaml`:

```xaml



```

### Columns

Available column types:
- TreeDataGridTemplateColumn
- TreeDataGridTextColumn
- TreeDataGridCheckBoxColumn
- TreeDataGridHierarchicalExpanderColumn

### Example: Countries

```xaml



















```

### Example: Drag/Drop

```xaml







```

### Example: Setting Columns from Style

To set `Columns` property from Style use `TreeDataGridColumnsTemplate` as `Setter.Value`.

```xaml



<Setter Property="Columns">
<TreeDataGridColumnsTemplate>
<objectModel:ObservableCollection x:TypeArguments="TreeDataGridColumn">
<TreeDataGridCheckBoxColumn Header="*" Binding="{Binding IsSelected}" Width="Auto" x:DataType="local:Country" />
<TreeDataGridTextColumn Header="Country" Binding="{Binding Name}" Width="6*" x:DataType="local:Country" />
<TreeDataGridTextColumn Header="Region" Binding="{Binding Region}" x:DataType="local:Country" />
<TreeDataGridTextColumn Header="Population" Binding="{Binding Population}" Width="3*" x:DataType="local:Country" />
<TreeDataGridTextColumn Header="Area" Binding="{Binding Area}" Width="3*" x:DataType="local:Country" />
<TreeDataGridTextColumn Header="GDP" Binding="{Binding GDP}" Width="3*" x:DataType="local:Country" />
</objectModel:ObservableCollection>
</TreeDataGridColumnsTemplate>
</Setter>

```

## Resources

* [GitHub source code repository.](https://github.com/wieslawsoltes/TreeDataGridEx)

## License

TreeDataGridEx is licensed under the [MIT license](LICENSE.TXT).