Symptom

A user reported that when a UI Control is marked as a region inside an Adorner, the region is never created.

Cause

The implementation of the Adorner did not add its children to the logical tree. Since Prism uses the SetValue method of the DependencyObject class to assign the instance of RegionManager, the UI Control with attached property must be in the logical tree.

Workaround

It is necessary to ensure that the UI Control marked as a region is located in the logical tree.

If you need to print the logical tree of a DependencyObject’s children, you could use the following method:

public static void PrintLogicalTree(int depth, object obj)
{
Debug.WriteLine(new String(' ', depth) + obj);

if (!(obj is DependencyObject)) return;

foreach (var child in LogicalTreeHelper.GetChildren(obj as DependencyObject))
{
PrintLogicalTree(depth + 1, child);
}
}

For more information on this topic, you could take a look at the following documentation section on MSDN: LogicalTreeHelper class

Additionally, you can find more information about this in the following work-item: work-item 7391

Last edited Nov 4, 2010 at 2:46 PM by fantivero, version 1

Comments

No comments yet.