I have a fairly large Silveright 3.0 project on the go, and I'm having problems accessing multiple font user resources from one of the assemblies.
I have a test test solution in which I added a custom font as a resource and can access it using XAML using:
<TextBlock Text="Test" FontFamily="FontName.ttf#Font Name" />
The test solution consists of the TestProject.Application and TestProject.Application.Web projects , with all the fun and games, obviously in the TestProject.Application project
However, when I try to do this in my main solution, the fonts refuse to show on the correct face type (instead, it is displayed in the default font). There is no difference in how the font was added to the project between the test solution and the main solution, and XAML is identical.
However, there is a difference in the layout of the solution. In the main solution, as well as in the MainApp.Application and MainApp.Application.Web project , I also have MainApp.Application.ViewModel and the MainApp.Application.Views project, and the XAML problem is the MainApp.Application.Views project (not the project .Application, as a test solution).
I tried to put the font in the .Application or .Application.Views project, tried to change the assembly action to content, embedded resource, etc., all to no avail.
So, is there a problem with accessing font resources from a child assembly that I donβt know about, or has anyone successfully done this?
My long-term need will be to have the correct custom fonts saved as resources in a separate .Application.FontLibrary assembly, which will load and cache on demand, and the XAML controls in the .Application.Views project will be needed to reference this FontLibrary assembly Get valid fonts. I also tried to create this separate assembly of the font library, and I cannot get the fonts from the second assembly.
As some additional information, I also tried the following font-referenced approaches:
<TextBlock Text="Test" FontFamily="/FontName.ttf#Font Name" /> <TextBlock Text="Test" FontFamily="pack:application,,,/FontName.ttf#Font Name" /> <TextBlock Text="Test" FontFamily="pack:application,,,/MainApp.Application.Views;/FontName.ttf#Font Name" /> <TextBlock Text="Test" FontFamily="pack:application,,,/MainApp.Application.Views;component/FontName.ttf#Font Name" />
And several similar options with different links to assembly / subdirectories / random semi-columns.
And so far nothing works ... did anyone hit this (and maybe solve it)?