2
Answers

Please clear my WPF controls doubt

Sachin Joseph

Sachin Joseph

14y
4.2k
1
I was trying to migrate one of my WinForms project to WPF.

Is there any method to get all controls on a WPF Window similar to MyWindowsForm.Controls() or MyWindowsFormGroupBox.Controls() to access all controls on a WPF Window?

How can I have access to all controls on a WPF Window or a WPF grid (not DataGrid) pragmatically?

How can I access all controls in a WPF Window or WPF Grid,  the Windows Forms way like this?:

For Each ctrl as Control in MyWindowsFormGroupBox.Controls()
      If TypeOf ctrl is TextBox Then CType(ctrl, TextBox).Text = ""
Next

Answers (2)