Search This Blog

Sunday 21 March 2021

How to Prevent System Font Size Changing to Android Mobile App Xamarin Forms

 Add Following Code in MainActivity.cs Page

AndroidProject/MainActivity.cs

 public override Resources Resources
 {
            get
            {
                Resources resource = base.Resources;
                Configuration configuration = new Configuration();
                configuration.SetToDefaults();
                if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.NMr1)
                {
                    return CreateConfigurationContext(configuration).Resources;
                }
                return resource;
            }
 }
 

Sunday 14 March 2021

How Pass Parameters to Tap Gesture Xamarin Forms

 Design Side : 

<Grid RowDefinitions="Auto" ColumnDefinitions="*,20">
        <Label Grid.Row="0" Text="Test Label"  TextColor="Gray" />
        <Grid.GestureRecognizers>
            <TapGestureRecognizer  CommandParameter="{Binding .}"  Tapped="TapGestureRecognizer_Tapped_SelectOption" />
        </Grid.GestureRecognizers>
</Grid>
Code Behind: 
private async void TapGestureRecognizer_Tapped_SelectOption(object sender, EventArgs e)
{
      var tapEventArgs = (TappedEventArgs)e;
      var parameter =   (ClassName) tapEventArgs.Parameter;
      //ClassName : Type Of Object That Going to return from CommandParameter
}
 

Popular Posts