3
votes

I try to get all WPF window controls collections. In other words i try to get the same result, as it was in win forms app's:

form.Controls

I want to use values of these controlls when i format an SQL query. It's possible to get such control collection of WPF window? Thanks

3

3 Answers

5
votes

Can I suggest that you stop thinking in terms of retrieving from the UI? You're using WPF which has an incredibly powerful databinding subsystem, so think in terms of retrieving from the model instead. If you read up on MVVM (Model View ViewModel), you'll see why you should be looking at the data instead, and how easy it is to do.

2
votes

You can use Me.gr1.Children, where gr1 is grid on your windows, just don't forget to name it as x:Name="gr1"