none
Uri reference to resource in assembly loaded on demand does not work.

    Question

  • Hi there,

    I do load an assembly on demand which holds resources (fonts) in it. The assembly is being loaded by the AssemblyPart class, and therefore added to the current application domain.

    txt1.FontFamily = New FontFamily("/SilverlightFontLibrary;component/GRAFFITO_01.ttf#Graffito") 
     
    Dim kaa = Application.GetResourceStream("/SilverlightFontLibrary;component/GRAFFITO_01.ttf".ToUri(UriKind.Relative)) 
    

    The font is not being applied to the text, but I do get the resource stream.

    If the assembly is inside the xap package everything works fine, but setting it to copy local false it won't show the correct font. :(

    I cannot use the FontSource to set the font directly as stream (which I definately have), because classes like Run, Paragraph or the RichTextBox simply do not have them. ;(

    Does anybody know whether MEF (Microsoft Extensibility Framework) can help me out of this?

    Is there any known way to accomplish that?

    I seriously need to refer to those resources, but cannot put them all into one xap package. :(

    Kind regards

     

    Thursday, July 08, 2010 11:06 AM

Answers

  • From this article, it's said that the only places where a font file resource can be resolved is as a resource target within the current assembly.  You can use InlineUIContainer in RichTextBox, add TextBlock instead of Run in it and then set FontSource


    Sunday, July 11, 2010 10:13 PM
  • Hi nangua,

    thank you for pointing that out :) I have read that article many times but simply overread  that important part. :(

     

    Though I have found a way to accomplish that! Use MEF.

    You can load other xap files and their embedded assemblies.

    These can be refered with normal assembly uri pathes! :)

     

    Kind regards

     

    Monday, July 12, 2010 4:22 AM

All replies

  • From this article, it's said that the only places where a font file resource can be resolved is as a resource target within the current assembly.  You can use InlineUIContainer in RichTextBox, add TextBlock instead of Run in it and then set FontSource


    Sunday, July 11, 2010 10:13 PM
  • Hi nangua,

    thank you for pointing that out :) I have read that article many times but simply overread  that important part. :(

     

    Though I have found a way to accomplish that! Use MEF.

    You can load other xap files and their embedded assemblies.

    These can be refered with normal assembly uri pathes! :)

     

    Kind regards

     

    Monday, July 12, 2010 4:22 AM