XAML designer broken when adding resource dictionaries to data or control templates - by Stephen Drew

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


15
0
Sign in
to vote
ID 772730 Comments
Status Closed Workarounds
Type Bug Repros 8
Opened 11/29/2012 6:40:22 AM
Access Restriction Public

Description

The XAML designer cannot handle external resource dictionaries within data or control templates.

"Unable to cast object of type 'Microsoft.Expression.Markup.DocumentModel.DocumentCompositeNode' to type 'System.Windows.ResourceDictionary'.

It compiles and runs fine, yet produces errors in the designer, and invalidates the useful work performed by tools such as Resharper.

You have helpfully closed a previous issue stating a workaround that is NOT a workaround:

http://connect.microsoft.com/VisualStudio/feedback/details/498844/wpf-designer-throws-invalidcastexception

If a template is loaded from XAML by its key, then it needs to have access to the resources it references either in the tree to which it is applied, or in the Application-level resources.  Sometimes, this is not desirable, and external resource dictionaries are required inside the template itself.

In addition, any resources defined in those external dictionaries are also not located and display designer errors.

This has been broken in three versions of Visual Studio now, and needs fixing.
Sign in to post a comment.
Posted by Mats Wessling on 4/16/2014 at 4:55 AM
In my document i have two controls that references two different dictionaries each of wich contains two different types of templates for the same family of view models.

I have:
1) A familty of viewModels
2) The resource dictionary containing templates for high level view of the view models
3) The resource dictionary containing templates for detailed views of the view models.
4) DataTemplate containing a treeview that uses the high level view and a Scrollviewer that uses low level views.

How could I do this better than refering to different resource dictionaries from the TreeView and the ScrollViewer respectively?



Posted by Microsoft on 2/14/2013 at 2:51 PM
Thanks for your feedback. Unfortunately, we won't be able to fix this in this release. Can you please share details why Resource Dictionary cannot be merged in the root document or App.xaml.

Please send an email at navit at microsoft dot com.
Posted by Microsoft on 11/29/2012 at 8:40 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 11/29/2012 at 6:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)