dynamiccomponentsmauichild-objects

MAUI - alter programmatically child objects


I wanna alter via code behind some properties (taking data from a DB)...

As a test, I've tryid this solution

  View v = this.Content;
  List<IVisualTreeElement> elements = (List<IVisualTreeElement>)v.GetVisualTreeDescendants();
  foreach (IVisualTreeElement button in elements)
  {
      if (button is Button)
      {
          Button myButton= (Button)button;
          myButton.IsVisible = false;
          myButton.TextColor = Colors.DeepPink;
      }
  }

but won't work (don't know why...)

What caon I do?

Google & doc searched,


Solution

  • Sometimes... after 4 times I've compiled with brakpoints etc...works. Don't ask me why.