別のページで使用される Resourcedictionary を作成したい (このページに従って、mergedwith を呼び出してページの resourceDictionary に追加します。https://xamarinhelp.com/merged-dictionaries-xamarin-forms/ ) しかし、私はエラーが発生し続けます。'Styledictionary': シール型 'ResourceDictionary' から派生できません。
Xamarin バージョン 4.1.2.18 を使用しています。クロスプラットフォームから xaml ページを追加しただけです。my.xaml は次のようになります
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="CrossPlatform.Styles.StylesDictionary">
<Style x:Key="EnumButtonStyle" TargetType="Button">
<Setter Property="BackGroundColor" Value="Green" />
<Setter Property="TextColor" Value="Red" />
</Style>
</ResourceDictionary >
そして.xaml.csは次のようになります
namespace CrossPlatform.Styles
{
public partial class StylesDictionary
{
public StylesDictionary()
{
InitializeComponent();
}
}
}