c# - Clear all TextBox in Window -
I'm programming in C # (WPF) I have a lot of The VisualTreeHelper class comes easy. You can use it like this: 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); }}
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
Post a Comment