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

Adding a sample for an editable TreeView #239

Merged
merged 26 commits into from
May 9, 2024

Conversation

h0lg
Copy link
Contributor

@h0lg h0lg commented Apr 19, 2024

In this PR I'm trying to raise a few questions and issues I encountered while working with the TreeView and AutoCompleteBox widgets.

It adds a third tab hosting a sample of an editable TreeView to the Gallery app's TreeViewPage that features adding, removing, renaming and filtering items while preserving tree node expansion. While I got that working, the solution involves a XAML style with a Binding that I don't like much.

As a follow-up to #231, it includes a working example of focusing an added TextBox - but trying the same on an AutoCompleteBox doesn't seem to work unless hitting a magic breakpoint during debugging. See commit changing input to AutoCompleteBox, breaking focus.

Note that it includes commits that run the EditableTreeView from the Playground app built only for dotnet for quicker testing - because building the Gallery takes a while. Those changes are reverted in the last commit.

You should be able to check out different commits to reproduce the different stages of broken and working features as described in the commit messages.

Please find my open questions in the commit added open questions.

Thank you for your time and consideration 🙏

@h0lg
Copy link
Contributor Author

h0lg commented Apr 22, 2024

@edgarfgp Thanks for the new model to try out and taking the time to answer! I've rebased on your changes, added your suggestion, applied some fixes and tested. Sadly, it's not quite working as it should.

I suspect two major issues:

  1. nested TreeViewItems with the IsExpanded being bound to the inner one when it should be bound to the outer
  2. the binding via isExpanded() seems to support one-way only

You'll find my detailed feedback and some code helping to showcase the nesting in the latest commit.

@edgarfgp
Copy link
Member

edgarfgp commented May 7, 2024

I suspect two major issues:

  1. nested TreeViewItem with the IsExpanded being bound to the inner one when it should be bound to the outer
  2. the binding via isExpanded() seems to support one-way only

Yeah I thought Avalonia itself will manage the TreeViewItem.IsExpanded but seems like we are forced to use .styles([ "avares://Gallery/Styles/EditableTreeView.xaml" ]) for now.

IsExpanded uses already BindingMode.TwoWay, but my guess is that is designed and implemented in a way that is xaml specific.

Screenshot 2024-05-07 at 14 24 55

Copy link
Member

@edgarfgp edgarfgp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for creating this sample. I would be ok merging this as the sample has improved and also the attachDevTools are handy.

@edgarfgp edgarfgp merged commit f13513b into fabulous-dev:main May 9, 2024
1 check passed
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edgarfgp Thanks for fixing the parameter name/doco mismatch and replacing Option with ValueOption - the latter was new to me.

@h0lg
Copy link
Contributor Author

h0lg commented May 9, 2024

@edgarfgp Thank you for your time and effort! I'll clean the unnecessary code from the new sample in a separate PR.

@h0lg h0lg deleted the editable-treeview branch May 9, 2024 10:15
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

Successfully merging this pull request may close these issues.

None yet

2 participants