Blend 2, Dec. Preview better with resource dictionaries? (Tor Langlo) - 12/8/2007 1:46 PM PST RRS feed

  • Question

  • By: Tor Langlo

    I am not sure if this is new to the latest Blend 2 preview release, but 
    this is progress (for me). Here's the deal (I think the issue has been 
    discussed before in other threads here and on the Cider forum):
    A UI element (Window, Page, UserControl, etc.) is dependent on resources 
    defined in a ResourceDictionary. For misc. reasons the ResourceDictionary 
    is merged into the application's resources at application level 
    (Application.Resources) instead of being merged in at the UI element level.
    Previously this has caused problems with Blend at designtime if the UI 
    element and ResourceDictionary were contained in separate assemblies. Blend 
    was not able to lookup the dictionary because it was associated with the 
    application object, and at designtime there's a different application 
    object at work (Blend's application object).
    To get to the point, it seems like the latest Blend 2 release is able to 
    solve the problem as long as the following conditions are met:
    1. The solution file contains a WPF application that merges in the 
    necessary dictionaries in its App.xaml file.
    2. The WPF application references the assembly (assemblies).
    If you open the assembly (*.csproj) file containing the UI elements 
    (instead of opening the entire solution file (*.sln)), Blend will not find 
    the resource dictionaries. But, as soon as you add the application project 
    to the solution, the references are found.
    If you (like me) have a large application, you could create a new "special 
    purpose" application that only serves the purpose of providing the resource 
    dictionary references to Blend at designtime. This could help designtime 
    performance as well as avoid configuration set ups that Blend don't 
    Tor Langlo
    Koda Software
    Web: http://www.kodasoftware.com
    Blog: http://torlanglo.spaces.live.com
    Thursday, February 21, 2008 9:27 PM