Is visual tree walking bad practice?

Recently, I have seen several comments on how to walk on a visual tree, being a bad practice ( here, for example, ), but I have not seen or found a reason why this will be bad practice.

In the project, I am working on a little walk on the tree, so I wonder if I need to change all this in order to something else or just let it be what it is.

So, I think my main question here is that visual tree walking is really bad practice, and more importantly, if so, why?

Also, where (if at all?) Would a visual tree walk normally?

+4
source share
3 answers
  • , WPF "" , ( XAML, ..). , . , , WPF. (, , ).

  • , ; WPF, , (, ). , , LayoutUpdated .., .

+1

, -, .

, , , - - WPF - MVVM- MVP- , , , , .

"". WPF, , , ItemControl ( , ).

, , , . , , . - , .

, - - , (, , ) , , , . , ViewModels.

+1

, . , , , .

During the years of my work with wpf, I used the visual tree to walk only when creating some non-standard behaviors that could not be performed otherwise (or I did not find another way to execute them). I see the walk of the visual tree as a tool, for example, as a reflection. It’s good to know this, and it has its own applications and disadvantages.

0
source

All Articles