I trying to write a method that will look at a wpf usercontrol that contains other wpf usercontrol elements. For example one of the usercontrols contains a datagrid with columns added using xaml. I want to be able to manipulate a named column in the datagrid. I’m trying to use reflection and I can’t find a way to get the internal controls. I’ve tried the different get methods (GetProeprties, GetMembers, GetFields) but can’t find a collection of internal usercontrols. Any ideas would be appreciated.
Share
Have you tried using
FindName?Edit: This works in simple cases but for nested UserControls it may not. This being the case you could employ it recursively, here’s some sketchy implementation: