I know you can do it in CodeBehind with something like this…
#pragma warning disable 67
...
#pragma warning restore 67
But is there a way to do this type of thing in XAML?
For example, I have the following in my App.xaml…
<FontFamily x:Key="ExtendedFontFamily">Verdana</FontFamily>
And it keeps throwing me these VS errors (even though it builds successfully)…
Error 1 Type ‘FontFamily’ is not
usable as an object element because it
is not public or does not define a
public parameterless constructor or a
type
converter. C:\Users\jed.hunsaker\Documents\Work\NextGen\src\ESO.App.Reporting\ESO.App.Reporting.UI.Silverlight\App.xaml 8 4 ESO.App.Reporting.UI.Silverlight
and…
Error 2 The type ‘FontFamily’ does not
support direct
content. C:\Users\jed.hunsaker\Documents\Work\NextGen\src\ESO.App.Reporting\ESO.App.Reporting.UI.Silverlight\App.xaml 8 42 ESO.App.Reporting.UI.Silverlight
Unless you guys know a better way to store a FontFamily in your App.xaml, I’m all ears!
You should use a resource dictionary. Here is an example:
And you should reference in you App.xaml like so (assuming they are in a Resources folder):