Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Different Style within single XML for Entry, Button

$
0
0

Hello,

I have created Style like below

<Application.Resources>
    <ResourceDictionary>
     <Style x:Key="EntryStyle" TargetType="Entry">
         <Setter Property="TextColor" Value="Black" />
         <Setter Property="FontSize">
             <OnPlatform x:TypeArguments="x:String" Android="Medium" iOS="Medium" />
          </Setter>
         <Setter Property="FontAttributes"
            Value="Bold"/>
      </Style>
      </ResourceDictionary>
 </Application.Resources>

and used it for Entry in XML working fine, but now i have button too on page need different Font size and Text Color, so i tried below code

 <Application.Resources>
    <ResourceDictionary>
     <Style x:Key="EntryStyle" TargetType="Entry">
         <Setter Property="TextColor" Value="Black" />
         <Setter Property="FontSize">
             <OnPlatform x:TypeArguments="x:String" Android="Medium" iOS="Medium" />
          </Setter>
         <Setter Property="FontAttributes"
            Value="Bold"/>
      </Style>

         <Style x:Key="ButtonStyle" TargetType="Button">
         <Setter Property="TextColor" Value="White" />
         <Setter Property="FontSize">
             <OnPlatform x:TypeArguments="x:String" Android="Small" iOS="Small" />
          </Setter>
         <Setter Property="FontAttributes"
            Value="Bold"/>
      </Style>
      </ResourceDictionary>
 </Application.Resources>

But my App is crashing....

How i can define different Style and used it in XML ?

Please help.... thanks in advance


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>