私は独自のロジックを備えたこのカスタムコントロールを持っています
public class BackButton : Button
{
public BackButton()
{
this.DefaultStyleKey = typeof(Button);
this.Click += (s, e) => {
Services.NavigationService.GoBack();
};
}
}
デフォルトのスタイル BackButtonStyle を適用したいと思います。StandardStyles.xaml を編集したくないので、別の ResourceDictionary にある
<Style TargetType="controls:BackButton" BasedOn="{StaticResource BackButtonStyle}"/>
App.xaml で参照
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
<ResourceDictionary Source="Common/FrameworkStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
構築中ですが、この例外がスローされます:
Message = "Cannot find a Resource with the Name/Key BackButtonStyle [Line: 15 Position: 44]"
私は何を間違っていますか?