I need a way to access the ContentPresenter/ItemsPresenter from a control if it does exist.
I can't figure out how to easily do this with VisualTreeHelper.
Will I need to recursively search all children?
I need a way to access the ContentPresenter/ItemsPresenter from a control if it does exist.
I can't figure out how to easily do this with VisualTreeHelper.
Will I need to recursively search all children?
Copyright © 2021 Jogjafile Inc.
Yes you need to recurse through the Visual tree....FindVisualChild can do that for you...if you supply it with an instance to the control.
ContentPresenter myContentPresenter = FindVisualChild(dependencyobject);
Some links:
http://msdn.microsoft.com/en-us/library/system.windows.frameworktemplate.findname.aspx
http://blogs.msdn.com/b/wpfsdk/archive/2007/04/16/how-do-i-programmatically-interact-with-template-generated-elements-part-ii.aspx
http://social.msdn.microsoft.com/Forums/br/wpf/thread/3c77deb8-2778-49a3-bcc2-21b1ac595183