Dawwa | Слава Украине
❔ System.InvalidCast Exception when looping through Controls.Grid.Children
System.InvalidCastException: 'Unable to cast object of type 'System.Windows.Controls.Button' to type 'System.Windows.Controls.UIElementCollection'.'
trying to programatically add buttons to a grid, but I'm getting this error when looping through the grids children.
this is where I'm looping through it
this is the XAML defining the rows & columns
3 replies