I am creating my first WPF metro app. I am trying to extend the styles that come as part of a Metro app (in the Common/StandardStyles.xaml files)
I am not modifying that file.
Instead, I've created another resource file (in the root) called AppStyles.xaml. In it I placed this style:
<!-- Apply to all textblocks-->
<Style BasedOn="{StaticResource BasicTextStyle}" TargetType="TextBlock">
<Setter Property="Margin" Value="0,10,10,0"/></Style>
But when I run the application I get this error.
Cannot find a Resource with the Name/Key BasicTextStyle [Line: 17 Position: 44]
Is it not possible to do this?
(BTW, nowhere in the entire application does the BasicTextStyle get used or defined on Line 17 of any file, so I have no idea what page it is actually complaining about.)
The file that is handling the error, by the way is "App.g.i.cs" and it is the generic error handler.
The app runs fine if I remove the style I created.
I don't know anything about Metro-specific apps, but this should be standard XAML stuff. You need something like this in your AppStyles.xaml file:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Common/StandardStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
Once you have that may you refer to the resource in your custom XAML file. BTW, the error you're getting is referring to the AppStyles.xaml file itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With