I've run into an issue that I can seem to track down. I've attached a sample solution that reproduces the issue.
I'm binding a ContentControl's content to a workspace object that can change to different workspaces. I'm also creating a DataTemplate for each type of workspace so WPF knows how to render the workspace. The issue I'm running into, is when I attempt to inspect the VIsualTree of the current workspace and that workspace contains a XamDataGrid with its theme set. To inspect the VIsual Tree, I'm calling ApplyTemplate(). If one of the workspace views contains a XamDataGrid, and the XamDataGrid's Theme property is set, I start running into trouble. If I remove the Theme setting on the XamDataGrid, it works fine.
I don't beleive I'm doing anything wrong and since the only way to induce the problem (that I've seen so far) is to set a Theme on a XamGrid.
Can someone double check my sample and see if I'm doing anything wrong? Thanks!
Thanks, let me know what I can do to resolve this as soon as possible.
I'm calling ApplyTemplate() because I need to inspect the visual tree. In my particular case, I inspect the tree in order to apply keyboard focus, and to examine a possible custom attribute that may be applied to the first child of the applied template.
One other thing I noticed when writing the sample is that everything worked fine up until I applied my own control template to the container ContentControl.
Hello,
I am not completely sure, but I think I have seen this behavior before. I was able to reproduce what you described and it does not look right. Thank you for the sample and reporting this to us. I am going to create a support case on your behalf and bring this up to the development team to verify this.
Meanwhile, I can see that the template is applied even without calling ApplyTemplate. Is there a particular reason why you do it?