Avalonia icon indicating copy to clipboard operation
Avalonia copied to clipboard

GridSplitter should not be limited to be only working when its logical parent is a grid

Open martinrhan opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe. I have an ItemsControl which has a GridSplitter within its Items, and the ItemsPanel is a Grid. In this case, the GridSplitter don't work because in the private void InitializeData(bool showsPreview) method, It only consider its parent is Grid or not. For another instance, I want to place GridSplitter not directly as a child under the Grid, but child of its child. In such case GridSplitter also won't work.

Describe the solution you'd like There should be an property that allow user to specify which Grid to work with, not just the parent.

Describe alternatives you've considered Or instead of considering logical parent only, it check all ancestors in visual tree and choose nearest Grid.

Additional context N/A

martinrhan avatar Jul 04 '23 08:07 martinrhan

I personally somewhat like the idea to bubble visual tree if no logical parent was found. I think using a Grid that is not a parent of this control at all doesn't make much sense. So I prefer this way.

A PR is welcome once 11.0 has finally dropped, if you have the time to do.

timunie avatar Jul 04 '23 09:07 timunie

I am making a commit. Should I replace getting the logical parent with getting nearest visual ancestor, or add getting nearest visual ancestor if logical parent is not grid?

martinrhan avatar Jul 07 '23 06:07 martinrhan

or add getting nearest visual ancestor if logical parent is not grid?

I would prefer the this idea as we don't want to add any possible break of existing apps.

timunie avatar Jul 07 '23 06:07 timunie