Pro noblemo, glad to hear it worked out.


From: Stephen Price 
Sent: Friday, June 18, 2010 2:23 PM
To: ozWPF 
Subject: Re: missing resource


Perfect, got the URI right this time round. That should save me from having to 
fake all those styles!  


many thanks :)


Stephen


On Fri, Jun 18, 2010 at 11:55 AM, <[email protected]> wrote:

  Not sure if understand your particular situation exactly Stephen, but could 
you not do it programmatically (i.e. put the resources into a shared assembly 
and in that assembly have a RuntimeServices class or similar provide it on 
demand) a fair bit.

  e.g.

  In the shared Assembly 

  private ResourceDictionary  _rd;
  public static ResourceDictionary GetResourceDictionary()
  {
      if(_rd == null)
      {
          // Cache it
          _rd = new ResourceDictionary();
          _rd.Source =  
Uri(String.Format("pack://application:,,,/{0};component/Themes/Resources.xaml", 
sAssemblyName));
      }
      return _rd;
  }


  In the test project that creates the Shell inject it into the Shell with 
something like

  
shell.Resources.MergedDictionaries.Add(RuntimeServices.GetResourceDictionary());


  Does this help?



  From: Stephen Price 
  Sent: Friday, June 18, 2010 12:47 PM
  To: ozWPF 
  Subject: missing resource


  Hey all, 


  Working on some WPF and have hit something I'm sure is easy but can't seem to 
find an answer on.


  I've added a style to the main page and put the new style into a 
MergedDictionary, it works no problems. Where i've come unstuck is there's a 
unit test in another project that creates an instance of the shell. It now 
fails as it can't find the resource. I'm puzzled at how I add it. I tried 
copying the App.xaml file but it gives errors pointing to the fact the project 
doesn't like there being an ApplicationDefinition. 


  Just wondering how other people get around this? 


  cheers,
  Stephen


------------------------------------------------------------------------------


  _______________________________________________
  ozwpf mailing list
  [email protected]
  http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf



  _______________________________________________
  ozwpf mailing list
  [email protected]
  http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf






--------------------------------------------------------------------------------


_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf
_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf

Reply via email to