2016-12-09 1 views
4

私たちは、App.xamlのResourceDictionaryXamarinフォームスタイル属性対styleClassのを使ってスタイリング

クラスでのスタイルとstyleClassのオプションを作成することによって、我々は2つの方法で要素のスタイルを設定でき気づいたXamarinは、フォームアプリケーションを構築しています

App.xamlで

私たちは、その後、これがこの

ようcontentpagesのいずれかで使用されます

 <Style Class="EntryStandard" TargetType="Entry"> 
      <Setter Property="TextColor" Value="#575e62" /> 
      <Setter Property="BackgroundColor" Value="#9facb3" /> 
      <Setter Property="FontSize" Value="14" /> 
     </Style> 

を書きます210

<Entry StyleClass="EntryStandard" Placeholder="Login Name" Text="{Binding EntryEmailAddress}" /> 

キーとスタイルオプションが

これは、我々がApp.xaml

 <Style x:Key="ButtonMainMenu_Purple" TargetType="Button"> 
      <Setter Property="BackgroundColor" Value="#5d4785" /> 
      <Setter Property="FontSize" Value="14" /> 
      <Setter Property="TextColor" Value="#FFFFFF" /> 
     </Style> 

を書き、そして私達は私達のcontentpages

<Button Style="{StaticResource ButtonMainMenu_Purple}" Text="Friends" Command="{Binding OnFriendsButtonCommand}" /> 

両方の作業罰金に次のように使用するものです私はちょうどどちらが他のものより優れているのか、そしてなぜそれを知りたかったのですか?

+0

:(みんながクリスマス休憩しているように見えます.... –

答えて

3

標準スタイルは、比較的柔軟性のないWPFモデルに従います。スタイルクラスにはカスケードセマンティクスが含まれ、新しいthemeサポートの一部です。しかし、それらはあまり文書化されておらず、まだベータ版です。

関連する問題