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

Gtk3: Bottom item in a TreeGridView is unable to be expanded #2335

Open
Prism019 opened this issue Oct 15, 2022 · 0 comments
Open

Gtk3: Bottom item in a TreeGridView is unable to be expanded #2335

Prism019 opened this issue Oct 15, 2022 · 0 comments

Comments

@Prism019
Copy link

Expected Behavior

Expanding the bottom item in a TreeGridView will expand when the expansion arrow is clicked, also running the relevant event.

Actual Behavior

The element is not expanded.
The Expanding event of the TreeGridView is not called.

Steps to Reproduce the Problem

  1. Click the expand button on the bottom element of a TreeGridView

Code that Demonstrates the Problem

	public partial class MainForm : Form
	{
		// counter for uniquely identifying items in the TreeGridView
		int counter = 0;
		public MainForm()
		{
			// basic stuff
			Title = "Eto Forms TreeGridView Bug";
			MinimumSize = new Size(800, 800);
			
			// create the grid view, add a column to show the text
			var gridView = new TreeGridView();
			Content = gridView;
			gridView.Columns.Add(new GridColumn{HeaderText = "Text", DataCell = new TextBoxCell(0)});

			// create a new item collection, add a CollectionChanged callback to reload the node once added, and add an initial item.
			var gridViewItems = new TreeGridItemCollection();
			gridView.DataStore = gridViewItems;
			gridViewItems.CollectionChanged += (sender, e) => {
				if(e.NewItems == null) {
					return;
				}
			  	foreach(var i in e.NewItems) {
			  		System.Console.WriteLine("Reloading node " + (i as TreeGridItem).Values[0]);
					gridView.ReloadItem(i as TreeGridItem);
				}
			};
			var parentNode = new TreeGridItem{Values = new object[]{"test_parent" + counter}};
			parentNode.Children.Add(new TreeGridItem{Values = new object[]{"test_child" + counter}});
			counter++;
			gridViewItems.Add(parentNode);

			// callback to telegraph when expanding items occurs
			gridView.Expanding += (sender, e) => {
				System.Console.WriteLine("Expanding!");
			};

			// callbacks to manipulate the number of items in the TreeGridView
			gridView.CellClick += (sender, e) => {
				System.Console.WriteLine("Adding!");
				var addedParentNode = new TreeGridItem{Values = new object[]{"test_parent" + counter}};
				addedParentNode.Children.Add(new TreeGridItem{Values = new object[]{"test_child" + counter}});
				counter++;
				gridViewItems.Add(addedParentNode);
			};
			gridView.KeyDown += (sender, e) => {
				System.Console.WriteLine("Removing!");
				gridViewItems.RemoveAt(gridViewItems.Count - 1);
			};
		}
	}

Specifications

  • Version: 2.7.1
  • Platform(s): Gtk3
  • Operating System(s): NixOS 22.05

Additional Comments

I don't have the ability to test other platforms, so I'm not sure what other platforms this affects.

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

1 participant