I am vailidating the data displayed within my datagrid using the IdataErrorInfo interface (as described in a few other posts here oin the forum). The final problem that I am having is walking the visual tree of my current UI and finding all the controls that are in an error state.
foreach (object child in LogicalTreeHelper.GetChildren(obj)) { if (child is TextBox) { TextBox element = child as TextBox;
if (element.GetBindingBLOCKED EXPRESSION I get a recordPresenter as the Child element and it has no children.....
Thanks
Hello,
You can try using our helper methods for traversing the element tree of the application:
Infragistics.Windows.Utilities.GetAncestorFromType(...);
Infragistics.Windows.Utilities.GetDescendantFromType(...);
Infragistics.Windows.Utilities.GetAncestorFromName(...);
Infragistics.Windows.Utilities. GetDescendantFromName(...);
I am writing this code in a utility class, that will be passed an object and it needs to traverse the object looking for all controls that HasErrors and recurse to child elements.
I am unsure how you would envision the helper methods being used as iterators?
I must be missing something from your post - what I need is, given a xamdataGrid - how do I traverse its visual tree to find all 'cells' that contain validation errors?
IE: bool GetValidationErrors ( List<Errors> ValidationErrors, DependencyObject ControlToCheck )