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


 public override Resources Resources
                Resources resource = base.Resources;
                Configuration configuration = new Configuration();
                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" />
            <TapGestureRecognizer  CommandParameter="{Binding .}"  Tapped="TapGestureRecognizer_Tapped_SelectOption" />
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