c# - Clear all TextBox in Window -


I'm programming in C # (WPF) I have a lot of nested controls I want to clear the cleaner of my text box control which is in my application. It is very difficult to reach them by their name.

  Public Zero Clear All (Control C) {If (C Text Box) is (Text Box) c). Clear (); Return; } Leading (control child Gatechild (C)) {Clear all (children); }}    

The VisualTreeHelper class comes easy. You can use it like this:

  Fixed public Zero TraverseVisualTree (view myMainWindow) {int childrenCount = VisualTreeHelper.GetChildrenCount (myMainWindow); For (int i = 0; i & lt; kidsCount; i ++) {var visualchild = (Visual) VisualTreeHelper.GetChild (myMainWindow, i); If (Visual Child Text Box) {Text Box TB = (Text Box) VisualBold; tb.Clear (); } TraverseVisualTree (Visual Child); }}    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -