按鈕 BackgroundColor 無法使用 ResourceDictionary 樣式更改
在 App.xaml 中
<Application.Resources>
<ResourceDictionary>
<Color x:Key="WarningButtonBackGroundColor">#eb8916</Color>
<Style x:Key="WarningButtonStyle" TargetType="Button">
<Setter Property="BackgroundColor" Value="{StaticResource WarningButtonBackGroundColor}"></Setter>
</Style>
</ResourceDictionary>
</Application.Resources>
在 page.xaml
<Button Text="Delete" Style="{StaticResource WarningButtonStyle}"></Button>
按鈕 BackgroundColor 不符合預期
uj5u.com熱心網友回復:
還是一樣的輸出。
應用程式.xaml
<Application.Resources>
<ResourceDictionary>
<Color x:Key="WarningButtonBackGroundColor">#eb8916</Color>
<Style x:Key="WarningButtonStyle" TargetType="Button">
<Setter Property="BackgroundColor" Value="{StaticResource WarningButtonBackGroundColor}" />
</Style>
</ResourceDictionary>
</Application.Resources>
主頁.xaml
<Button Style="{StaticResource WarningButtonStyle}" Text="Delete" />

轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/528303.html
