Cannot find resource with AppBarButtonStyle name / key

The generic style included in winrt gives me an exception

<Button Style="{StaticResource AppBarButtonStyle}" /> 

this base code Cannot find a Resource with the Name/Key AppBarButtonStyle

Shares are included in my app.xaml, and I can navigate by the definition of this style.

Am I missing something really big here?

ps: I tried restarting VS

+4
source share
4 answers

On Windows 8.1, the StandardStyles.xaml file containing the AppBarButtonStyle has been deleted. Instead, you can use the AppBarButton, as shown below:

 <AppBarButton Icon="Play" Label="Play" /> 

Check out this article by Tim Heyer: http://timheuer.com/blog/archive/2013/10/29/remove-standardstyles-xaml-from-windows-8-1-winrt-projects.aspx

+2
source

Here are your three possible reasons:

  • Is there any /Common/StandardStyles.xaml yet?
  • Is AppBarButtonStyle still in /Common/StandardStyles.xaml?
  • Does App.xaml add the link /Common/StandardStyles.xaml?

App.xaml should look something like this:

 <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Common/StandardStyles.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> 

Good luck

+1
source

我 遇到 这个 问题 是 在 一个 单独 的 资源 字典 里 定义

 <Button Style="{StaticResource AppBarButtonStyle}" /> 

如果 将 其 放到 某个 页面 的 xmal 内部 的 resource 里, OK.

我 解决 这个 问题 是 在 资源 字典 头部 添加

 <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Common/StandardStyles.xaml"/> </ResourceDictionary.MergedDictionaries> 
+1
source

I fixed it by specifying AppBarButtonStyle in front of my customized styles that extend AppBarButtonStyle.

+1
source

All Articles