Delete a child from dynamic layout Eto Forms

Hello,

I am creating at the moment a small plugin for Rhino with Eto Forms with C#. I created a TableLayout inside of a DynamicLayout and now I want delete the TableLayout from the DynamicLayout with an event binded to a Button. I find the TableLayout with iterating over the Controls IEnumerable but if I try to execute the Container.Remove(child) function, nothing happens. I tried also Child.Detach() and Child.Dispose() and it removes the TableView visually but if look into the DynamicLayout object during the debug process the TableLayout is still there. Why? It is a pain :-). Maybe someone had the same issue, so please give me a tip.

Best,

Samid

Hey @samid,

A good way to do this is to use a Panel for where you want to update the UI with different content. Something like:


// set things up
var myPanel = new Panel();

var layout = new DynamicLayout();
layout.Add(myPanel);

// show the TableLayout
var myChildTableLayout = new TableLayout();
myPanel.Content = myChildTableLayout;

// remove the TableLayout
myPanel.Content = null;

Hope this helps!

Hi Curtis,

thank you. That’s is exactly this what need.

Best,
Dimitrij