Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TreeDataGrid Support #386

Open
GallaFrancesco opened this issue Jan 15, 2024 · 7 comments
Open

TreeDataGrid Support #386

GallaFrancesco opened this issue Jan 15, 2024 · 7 comments

Comments

@GallaFrancesco
Copy link
Contributor

Are there any plans to support TreeDataGrid in FuncUI?

It should be possible to use it in place of DataGrid with the additional benefits of having TreeView on top and other perks such as SelectableTextBlock by default on DataGridTextColumn.

@Numpsy
Copy link
Collaborator

Numpsy commented Jan 15, 2024

I've been making some simple use of it in a FuncUI application and there could be some 'official' bindings for it, though I don't think the core library should depend on it.

@GallaFrancesco
Copy link
Contributor Author

GallaFrancesco commented Jan 16, 2024

Why not? The DataGrid control is supported and it's managed by the Avalonia organization as well. I know TreeDataGrid is a separate package but technically DataGrid is as well, even though the sources are in the AvaloniaUI repo https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Controls.DataGrid/DataGrid.cs

@JaggerJo
Copy link
Member

Would you contribute the bindings?

I'm not entirely happy with how we included the bindings for data grid in the main library. This creates a transitive dependency on Avalonia.Controls.DataGrid for all projects referencing FuncUI.

We should have small binding packages for control libraries.

@Numpsy
Copy link
Collaborator

Numpsy commented Jan 19, 2024

TreeDataGrid also has a dependency on System.Reactive, which is quite large itself, so I don't think forcing a dependency is ideal (not my descision of course)

@JaggerJo
Copy link
Member

TreeDataGrid also has a dependency on System.Reactive, which is quite large itself, so I don't think forcing a dependency is ideal (not my descision of course)

💯 agreed.

@Numpsy
Copy link
Collaborator

Numpsy commented Jan 30, 2024

Hmm, had a look at my usage of TreeDataGrid and it's basically all code behind style and no real bindings - e.g. doing things like

let makeTreeDataSource initialItems =
    let gridSauce =
        new HierarchicalTreeDataGridSource<StructuredSectionContent>(items = initialItems)

    gridSauce.Columns.Add(
        HierarchicalExpanderColumn<StructuredSectionContent>(
            TextColumn<StructuredSectionContent, string>("Name", (fun section -> section.DisplayName)),
            (fun x -> x.SubSections),
            (fun x -> not (Seq.isEmpty x.SubSections))
        )
    )

    gridSauce.Columns.Add(
        TextColumn<StructuredSectionContent, string>("Value", (fun section -> section.DisplayValue))
    )

    gridSauce

and then just assigning that to the Source property of the grid in an init function.

@Numpsy
Copy link
Collaborator

Numpsy commented Sep 12, 2024

fwiw, there's a discussion at AvaloniaUI/Avalonia#16997 about relicensing TreeDataGrid with a dual license AGPL-3 / Commercial license, and I think that itself would rule out having the main libraries here depend on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants