あなたが定義することができます。あなたがそうのようなあなたのApp.xaml
にこれらThemeResources
を追加することができますブラシあなたのテキストボックスのボーダーの色を変更するので、
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}" />
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundAltHighBrush}" />
<Setter Property="BackgroundFocusBrush" Value="{ThemeResource SystemControlBackgroundChromeWhiteBrush}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundChromeDisabledLowBrush}" />
:
は、あなたは以下のスタイルの色をオーバーライドする必要がありますApp.xamlのスタイルセッタープロパティ
<ResourceDictionary>
<Style TargetType="Button" x:Name="myNewButtonStyle">
<Setter Property="Background" Value="{ThemeResource ButtonBackgroundThemeBrush}" />
</Style>
</ResourceDictionary>
は、その後、あなたがテーマリソースディクショナリのキーを使用して適用することができるであろう同様の方法で色
protected override void OnElementChanged(ElementChangedEventArgs<Button> e)
{
base.OnElementChanged(e);
if (this.Element != null)
{
this.Control.Style = Windows.UI.Xaml.Application.Current.Resources["myNewButtonStyle"] as Windows.UI.Xaml.Style;
}
}
を変更する必要があるコントロールのCustomRendererを使用しています。このコードを使用すると、Xamarinのコントロールでネイティブスタイルを使用できます。
私は 'Xamarin.Forms'のカスタムビルドが必要か、ここに表示されている' ThemeResource'の値をオーバーライドする必要があると言っていますか?もしそうなら、私はそれらの値をどのように上書きするでしょうか? – user1
また、これを行う唯一の方法はXAMLですか?これをコードで達成する方法はありますか? – jbyrd