Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF remove grid layout child using name

Tags:

layout

wpf

grid

Given a Grid, I'm adding a child to it using Grid.Children.Add(element). How can I remove this element using its name? Something like Grid.Children.Remove("name")

like image 422
Aks Avatar asked May 09 '26 18:05

Aks


1 Answers

UIElement child = grid1.FindName("name") as UIElement;
grid1.Children.Remove(child);
like image 128
decyclone Avatar answered May 11 '26 15:05

decyclone



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!