Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 79144 articles
Browse latest View live

Hide the keyboard on Entry focus event

$
0
0

Hi
I want to hide the keyboard when i click on Entry
I was able to do this by set **IsReadOnly ** property to true
Now I want to launch an event when I click on **Entry **

I used this code, but I don't want to disable the control
~~~.

        <StackLayout>
                        <Entry x:Name="myEntry" IsEnabled="False"/>
                        <StackLayout.GestureRecognizers>
                            <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped" NumberOfTapsRequired="1">
                            </TapGestureRecognizer>
                        </StackLayout.GestureRecognizers>
                    </StackLayout>

~~~

Thank you in advance.


How to optimize the build time for Android project?

$
0
0

I have a solution which contains various projects, every individual project takes milliseconds to built but for droid project it takes approx 1 hour to build. I tried to have detailed summary while building the project from terminal(command line) , it says under Task Performance summary Core compile alone took 54 minutes to complete. What project settings do i need to configure to reduce the build time significantly. Any help will be much appreciated.
@JamesMontemagno @JohnMiller @JonDouglas @JonathanPeppers

Does xamarin ever call finalizers?

$
0
0

Finalizer in this basic code, written in a template project doesnt get called ever.
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
var vm = new VM();
DisplayAlert("", File.Exists(vm.P).ToString(),"cancel");
}

    ~MainPage()
    {
        File.WriteAllText(((VM)BindingContext).P, "Test");
    }
}

How to target MacOS and Windows using Xamarin Forms?

$
0
0

I want to use Visual Studio for Mac to write a c# .net Forms type application that will run on both MacOS and Windows.
Ca I do this with Xamarin and VS for Mac? Is there a template somewhere for a Hello World that will do this? Run on both targets?

How to set `RowHeight` for ListView as Platform Specific .

$
0
0

is it possible to set RowHeight of ListView as Platform Specific ?
i did with this-

<ListView.RowHeight> <OnPlatform x:TypeArguments="x:Double"> <On Platform="iOS" Value="65" /> <On Platform="Android" Value="70" /> </OnPlatform> </ListView.RowHeight>

but i getting below error -

Position 255:22. No property, bindable property, or event found for 'RowHeight

How to integrate PayuMoney payment gateway with xamarin forms ?

$
0
0

How can i make payment by payuMoney gateway by xamarin forms ?

Can we add Payumoney gateway to xamarin forms??

$
0
0

Hello friends,
I needto add payment gateway to my xamarin forms PCL project..Is it Possible?

Open file from gmail application

$
0
0

Hi,

I'am trying to open a pdf file from other apps. Howewer from email attachment it doesn't work, my cursor is returning null.

Here is my code used to open file from intent.

  `public class IntentHelper
   {
    private readonly MainActivity mainActivity;

    public IntentHelper(MainActivity mainActivity)
    {
        this.mainActivity = mainActivity;
    }

    public void GetFilePathFromIntent()
    {
        if (Intent.ActionView.Equals(mainActivity.Intent.Action) && (mainActivity.Intent.Type?.Equals("application/pdf") ?? false))
        {
            var path = GetRealPathFromUri(Android.App.Application.Context, mainActivity.Intent.Data);

            //TODO -- Implement try catch
            App.LoadPdf(path);
        }
    }

    public static string GetRealPathFromUri(Context context, Android.Net.Uri uri)
    {

        bool isKitKat = Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Kitkat;

        // DocumentProvider
        if (isKitKat && Android.Provider.DocumentsContract.IsDocumentUri(context, uri))
        {
            // ExternalStorageProvider
            if (IsExternalStorageDocument(uri))
                return GetExternalStorageDocument(uri);
            // DownloadsProvider
            else if (IsDownloadsDocument(uri))
                return GetDownloadDirectory(context, uri);
            // MediaProvider
            else if (IsMediaDocument(uri))
                return GetMediaDirectory(context, uri);
        }
        // MediaStore (and general)
        else if ("content".Equals(uri.Scheme, StringComparison.OrdinalIgnoreCase))
        {
            return GetDataColumn(context, uri, null, null);
        }
        // File
        else if ("file".Equals(uri.Scheme, StringComparison.OrdinalIgnoreCase))
        {
            return uri.Path;
        }

        return null;
    }

    public static bool IsExternalStorageDocument(Android.Net.Uri uri)
    {
        return "com.android.externalstorage.documents".Equals(uri.Authority);
    }

    private static string GetExternalStorageDocument(Uri uri)
    {
        var docId = Android.Provider.DocumentsContract.GetDocumentId(uri);
        var split = docId.Split(':');
        var type = split[0];

        return "primary".Equals(type, StringComparison.OrdinalIgnoreCase)
            ? Android.OS.Environment.ExternalStorageDirectory + "/" + split[1]
            : null;
    }

    private static bool IsDownloadsDocument(Android.Net.Uri uri)
    {
        return "com.android.providers.downloads.documents".Equals(uri.Authority);
    }

    private static string GetDownloadDirectory(Context context, Uri uri)
    {
        var id = Android.Provider.DocumentsContract.GetDocumentId(uri);
        var contentUri = ContentUris.WithAppendedId(Android.Net.Uri.Parse("content://downloads/public_downloads"),
            Convert.ToInt64(id));

        return GetDataColumn(context, contentUri, null, null);
    }

    private static bool IsMediaDocument(Android.Net.Uri uri)
    {
        return "com.android.providers.media.documents".Equals(uri.Authority);
    }

    private static string GetMediaDirectory(Context context, Uri uri)
    {
        var docId = Android.Provider.DocumentsContract.GetDocumentId(uri);
        var split = docId.Split(':');
        var type = split[0];

        Uri contentUri = type switch
        {
            "image" => Android.Provider.MediaStore.Images.Media.ExternalContentUri,
            "video" => Android.Provider.MediaStore.Video.Media.ExternalContentUri,
            "audio" => Android.Provider.MediaStore.Audio.Media.ExternalContentUri,
            _ => null
        };

        const string selection = "_id=?";
        var selectionArgs = new string[]
        {
            split[1]
        };

        return GetDataColumn(context, contentUri, selection, selectionArgs);
    }

    public static string GetDataColumn(Context context, Android.Net.Uri uri, String selection,
        string[] selectionArgs)
    {
        Android.Database.ICursor cursor = null;
        const string column = "_data";
        string[] projection = {
            column
        };

        try
        {
            cursor = context.ContentResolver.Query(uri, projection, selection, selectionArgs,
                null);
            if (cursor != null && cursor.MoveToFirst())
            {
                var column_index = cursor.GetColumnIndexOrThrow(column);
                return cursor.GetString(column_index);
            }
        }
        finally
        {
            cursor?.Close();
        }

        return null;
    }
}`

If I try to open a document from the file explorer it will work. Howewer If the document isn't stored initially in the device I cannot get the uri.

I try to use Intent.ActionView or Intent.ActionOpenDocument but it doesn't work.

Any tips ?


PhotoPicker not responsive on iOS

$
0
0

Hi,

The photo picker on iOS seems to work intermittently - the picker screen appears, i can select an album, however when I tap a photo or press the cancel button, nothing happens - it doesn't seem to register the tap.

This only happens intermittently and i'm not sure what's wrong (or what to investigate to figure it out). Seems to work ok on the simulator, but not on a real device (iPhone XS Max iOS 13.4.1, Xamarin Forms 4.8.0.1269).

The code i have is as follows:

async void btn_select_clicked(System.Object sender, System.EventArgs e)
        {

            var requestPermission = await Permissions.RequestAsync<Permissions.Photos>();
            var status = await Xamarin.Essentials.Permissions.CheckStatusAsync<Permissions.Photos>();


            if (status != Xamarin.Essentials.PermissionStatus.Granted)
            {
                await DisplayAlert("Can't access photos", "Please grant access to Photos to upload a profile picture", "OK");
                return;
            }

            var file = await Plugin.Media.CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions
            {
                PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium,

            });

            if (file == null)
                return;
            img_editor.Source = ImageSource.FromStream(() =>
            {
                var stream = file.GetStream();
                file.Dispose();
                return stream;
            });
            btn_upload.IsVisible = true;
            btn_upload.IsEnabled = true;
        }

What is also odd is when this particular page itself that has select button on it is loaded via Navigation.PushAsync - the photopicker doesn't appear at all, but it does work when doing Navigation.PushModalAsync- which isn't ideal.

On this page I also have a SyncFusion Image Editor (img_editor) inside a Grid within Absolute Layout if that makes any difference..

Xamarin.Forms Themes No embeddedresource found

$
0
0

I'm transitioning my app from using AppThemeColor to ResourceDictionary.

I followed the steps from https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/theming/theming

I created the LightTheme.xaml & DarkTheme.xaml with code behind using Visual Studio for Mac. Everything is working fine on the mac, both with the simulator and a real iOS device.

When I run for UWP, using Microsoft Visual Studio Community 2019, when loading any of the theme xaml classes, I get the following error:

Xamarin.Forms.Xaml.XamlParseException
  HResult=0x80131500
  Message=No embeddedresource found for RealityMMA.Themes.LightTheme
  Source=Xamarin.Forms.Xaml
  StackTrace:
   at Xamarin.Forms.Xaml.XamlLoader.Load(Object view, Type callingType)
   at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TXaml](TXaml view, Type callingType)
   at RealityMMA.Themes.LightTheme.InitializeComponent() in C:\Source\Reality\cmq-mobile-app\RealityMMA\RealityMMA.UWP\obj\x64\Debug\LightTheme.xaml.g.cs:line 21
   at RealityMMA.Themes.LightTheme..ctor() in C:\Source\Reality\cmq-mobile-app\RealityMMA\RealityMMA\Themes\LightTheme.xaml.cs:line 9

I get the error regardless of the theme.

I notice that in the XamlFilePathAttribute, that it has the right path, but the XamlResourceIdAttribute is inserting .UWP into the name.

I also tried using Microsoft Visual Studio Community 2017 on another Windows machine, but get all the same.

Binding: Mode Two way works well without Break Point, but works strange with it.

$
0
0

I have a an entry which is binded to a string in TwoWay mode.
When it runs without any breakpoints it works well.
When I put a break point in the set of the property and then erase some character in the entry,
it seems to erase all the characters one after an other, until ALL the characters are being erased (The break point is hit again and again and again
instead one time...)
Why is it?

This is the entry:
<Entry x:Name="myEntry" Text="{Binding TheFirstNameOfThePerson, Mode=TwoWay}" />

This is the C# code of the page that contains the entry:

    public partial class MainPage : ContentPage
        {
            public MainPageViewModel MainPageViewModel { get; set; }
            public MainPage()
            {
                InitializeComponent();
                MainPageViewModel = new MainPageViewModel();
                this.BindingContext = MainPageViewModel;
            }
        }

This is the viewModel:

public class MainPageViewModel:INotifyPropertyChanged
 {
    public Person Person { get; set; }
    public MainPageViewModel()
    {
        Person = new Person
       {
           Id = 100,
           FirstName = "Shabi"
       };
     }    

     public string TheFirstNameOfThePerson
     {
         get => Person.FirstName;
         set                   //Here I put the break point
         {
             Person.FirstName = value;
             OnPropertyChanged();
         }
     }

     public event PropertyChangedEventHandler PropertyChanged;
     protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
     {
         PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
     }
 }

This is the model:

    public class Person
    {
        public int Id { get; set; }
        public string FirstName { get; set; }
    }

i want to pick image from gallery in xamarin forms and upload to azure sql Server

$
0
0

via .net core web api and i already did but the problem is
when i use emulator everything work but in real device the image not uploading
i already added these inside manifest
uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"
uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"
uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
uses-permission android:name="com.android.browser.permission.WRITE_HISTORY_BOOKMARKS"
uses-permission android:name="android.permission.INTERNET"

Xamarin forms bottom sheet

$
0
0

Hello everyone,

I'm trying to implement a bottom sheet view in xamarin forms.
I'm follow this sample: https://www.heyraviteja.com/post/projects/xamarin-bottom-sheet/ but on android this isn't smooth.
In xamarin docs section of pan gesture ( https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/gestures/pan) i read that i need a pan container to do translations more linear.

So I have copy that pan container and inside I put my Frame. This is my code:

PanContainer:

public class PanContainer: ContentView
    {
        double x, y;

        public PanContainer()
        {
            // Set PanGestureRecognizer.TouchPoints to control the 
            // number of touch points needed to pan
            var panGesture = new PanGestureRecognizer();
            panGesture.PanUpdated += OnPanUpdated;
            GestureRecognizers.Add(panGesture);
        }

        void OnPanUpdated(object sender, PanUpdatedEventArgs e)
        {
            switch (e.StatusType)
            {

                case GestureStatus.Running:
                    // Translate and ensure we don't pan beyond the wrapped user interface element bounds.
                    Content.TranslationY = Math.Max(Math.Min(0, y + e.TotalY), -Math.Abs((Height * .25) - Height));//Math.Max (Math.Min (0, y + e.TotalY), -Math.Abs (Content.Height - App.ScreenHeight));  
                    break;

                case GestureStatus.Completed:
                    // Store the translation applied during the pan
                    y = Content.TranslationY;
                    break;
            }
        }
    }

My View:

<RelativeLayout>
    <StackLayout>

    </StackLayout>
    <views:PanContainer
                RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent,
                                                                       Property=Height,
                                                                       Factor=1,
                                                                       Constant=0}"
                RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent,
                                                                      Property=Width,
                                                                      Factor=1,
                                                                      Constant=0}"
                RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent,
                                                                  Property=Height,
                                                                  Factor=.9,
                                                                  Constant=0}">
                <Frame
                    x:Name="bottomSheet"
                    Padding="1,4,1,0"
                    BackgroundColor="#faf9f8"
                    CornerRadius="15"
                    HasShadow="true">

                    <StackLayout Spacing="5">
                      //other....
                    </StackLayout>
                </Frame>
       </views:PanContainer>
</RelativeLayout>

Now the frame is very smoothly but there is a problem. The only part where i can do the panGesture is the red part in the picture:

even if the layout is expanded. Without painContainer I can do the gesture in each point inside the frame (with the relative layout contraint putted in the frame instead in the panContainer)

Could someone help me to understand the difference from the two cases and try to solve the problem?

Thank's a lot!

ControlTemplate being removed from page when navigating back.

$
0
0

I'm trying to implement a base page where I have an Ad view rendered in all pages.
To accomplish these I created a ControlTemplate with the Ad in it and the content, the file is called BasePageControlTemplate:

<ResourceDictionary
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:navigationDrawer="clr-namespace:Syncfusion.SfNavigationDrawer.XForms;assembly=Syncfusion.SfNavigationDrawer.XForms"
    xmlns:state="clr-namespace:Xamarin.Forms.StateSquid;assembly=Xamarin.Forms.StateSquid"
    xmlns:xt="clr-namespace:Fighter_MoveList.MarkUpExtensions">
    <ControlTemplate x:Key="BasePageTemplate">
        <Grid RowSpacing="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <StackLayout
                Grid.Row="0"
                state:StateLayout.CurrentState="{Binding PageState}"
                BindingContext="{Binding Source={RelativeSource TemplatedParent}, Path=BindingContext}">
                <ContentPresenter />
            </StackLayout>
            <ContentView Grid.Row="1" Content="{StaticResource AdControlViewMain}" />
        </Grid>
    </ControlTemplate>
</ResourceDictionary>

Code of the Ad:

<views:AdControlView
            x:Key="AdControlViewMain"
            AdUnit="XXX"
            BackgroundColor="{StaticResource AccentColor}" />

This works at first, the flow is from left to right (Notice the bar on the bottom, thats de ad):

However, when navigating back from the back arrow in the toolbar the previous page looks like this (Notice the bar on the bottom is not seen anymore):

Why does this happen?
I do have the controlTemplate in both pages:
RosterPage:

<pages:BasePage
    x:Class="Fighter_MoveList.Views.RosterPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:d="http://xamarin.com/schemas/2014/forms/design"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:models="clr-namespace:Fighter_MoveList.Models"
    xmlns:pages="clr-namespace:Fighter_MoveList.Views"
    xmlns:pviews="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView"
    xmlns:views="clr-namespace:Fighter_MoveList.ContentViews"
    xmlns:vm="clr-namespace:Fighter_MoveList.ViewModels"
    xmlns:xt="clr-namespace:Fighter_MoveList.MarkUpExtensions"
    Title="{xt:Translate roster_title}"
    x:DataType="vm:RosterViewModel"
    ControlTemplate="{StaticResource BasePageTemplate}"
    mc:Ignorable="d">
    <ContentPage.ToolbarItems>
        <ToolbarItem Clicked="InfoItem_Clicked" IconImageSource="info" />
    </ContentPage.ToolbarItems>
    <ContentPage.Content>
        ...
    </ContentPage.Content>
</pages:BasePage>

FighterDetailPage:

<pages:BasePage
    x:Class="Fighter_MoveList.Views.FighterDetailPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:models="clr-namespace:Fighter_MoveList.Models"
    xmlns:pages="clr-namespace:Fighter_MoveList.Views"
    xmlns:sfBorder="clr-namespace:Syncfusion.XForms.Border;assembly=Syncfusion.Core.XForms"
    xmlns:views="clr-namespace:Fighter_MoveList.ContentViews"
    xmlns:vm="clr-namespace:Fighter_MoveList.ViewModels"
    xmlns:xt="clr-namespace:Fighter_MoveList.MarkUpExtensions"
    Title="{Binding Title}"
    x:DataType="vm:FighterDetailViewModel"
    ControlTemplate="{StaticResource BasePageTemplate}">
    <pages:BasePage.Resources>
        <Thickness x:Key="FooterSpacing" Top="100" />
    </pages:BasePage.Resources>
    ...
</pages:BasePage>

I don't know if its related, but I'm using shell for navigation:
Routing.RegisterRoute(nameof(FighterDetailPage), typeof(FighterDetailPage));
This is how i go to it:
await Shell.Current.GoToAsync($"{nameof(FighterDetailPage)}?FighterId={selectedItem}");

I don't know if im missing something when using ControlTemplate.
Thanks in anticipation.

Reset Picker with no value

$
0
0

Have a Picker with some value , how do i reset the Picker with no value when i want to use it again .

After selecting an item a listview is filled and the Picker Isvisible is false.

But what do i change to start with the Title "Kies een team ↓ " like the first time

 <Picker x:Name="picker"

        Title="Kies een team ↓ "
        TitleColor="{AppThemeBinding Light=Black, Dark=White}" FontSize="Medium" BackgroundColor="Transparent" SelectedIndexChanged="picker_SelectedIndexChanged" AbsoluteLayout.LayoutBounds=".5,.25,.70,.15" AbsoluteLayout.LayoutFlags="All" HorizontalOptions="Center" >
                                <Picker.ItemsSource>
                                    <x:Array Type="{x:Type x:String}">
                                        <x:String>1e elftal</x:String>
                                        <x:String>2e elftal</x:String>
                                        <x:String>JO16-1</x:String>
                                        <x:String>JO15-1</x:String>
                                        <x:String>JO13</x:String>
                                        <x:String>JO11</x:String>
                                        <x:String>JO10</x:String>
                                        <x:String>JO7</x:String>
                                    </x:Array>
                                </Picker.ItemsSource>
                            </Picker>

 async void mysub()
        {
            Selecteer.Text = picker.SelectedItem.ToString();
            picker.IsVisible = false;

     ///// fill a Listview with the Text depending on Selecteer.Text 

}

To start again

  picker.IsVisible = true;


Do stuff while splash screen is showing?

$
0
0

How can I do stuff while splash/launch screen is showing?
I want to do some API calls.

How to add new contact in phone book contact list using xamarin forms

$
0
0

Hello,

Please help me for add contact name and number in contact list of mobile in xamarin forms .net standard project.

Thanks in advance

Accessing iCloud in XF using Dependency Service

$
0
0

I was following @LandLu post in this forum thread.

The following line is giving a Null Exception:

//Get the iCloud's url
var filePath = NSFileManager.DefaultManager.GetUrlForUbiquityContainer(null).Append("Documents", true);

Even replacing the 'null' in the argument of GetUrlForUbiquityContainer with my container id which is of the form "iCloud.com.companyname.appname" didn't help.

What am I doing wrong?

I am using automatic provisioning. Is that wrong?

Also one more question:
In the following code in the same post, what is the namespace of File and Path?

//Here I write a test string in this document folder
File.WriteAllText(Path.Combine(filePath.Path, "test.txt"), "test");

Button Text Padding (Short Text) on Android

$
0
0

Hi there,

I'm trying to make the button fit the text inside it, but for some reason it's not working correctly on short text in Android only. (iOS works as expected)

In the example below, I'm expecting the button edges to be touching or at least very close to the labels.

Am I missing something, or is this a bug?

XF. 4.7.0.1239

`<?xml version="1.0" encoding="utf-8" ?>

<Grid>
    <CollectionView HeightRequest="0" ItemsLayout="HorizontalList" HorizontalOptions="Start" HorizontalScrollBarVisibility="Never" >
        <CollectionView.ItemsSource>
            <x:Array Type="{x:Type x:String}">
                <x:String>Monkey</x:String>
                <x:String>الكل</x:String>
                <x:String>قيمة</x:String>
                <x:String>ن</x:String>
                <x:String>A</x:String>
                <x:String>Howler</x:String>
                <x:String>very long item name</x:String>
            </x:Array>
        </CollectionView.ItemsSource>
        <CollectionView.ItemTemplate>
            <DataTemplate>
                <Grid Padding="0,0,0,0" Margin="0,0,0,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="35" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"  />
                    </Grid.ColumnDefinitions>
                    <Button
                                Text="{Binding .}"
                                BorderColor="#F1F1F1"
                                BorderWidth="1"
                                Padding="0,0,0,0"
                                Margin="0,0,0,0"
                                MinimumWidthRequest="1"
                                MinimumHeightRequest="1"
                                FontAttributes="Bold">
                    </Button>
                </Grid>
            </DataTemplate>
        </CollectionView.ItemTemplate>
    </CollectionView>
</Grid>


`

Help making a focus timer app(help make the timer countdown)

$
0
0
public partial class MainPage : ContentPage

{

private System.Timers.Timer \_timer;

private int count = 0;



public MainPage()

{

InitializeComponent();

}

void Main()

{

\_timer = new System.Timers.Timer();

//trigger event every second

\_timer.Interval = 1000;

\_timer.Elapsed += OnTimedEvent;



}

private void OnTimedEvent(object sender, EventArgs e) {

count--;

\_timer.Enabled = true;



TimerLabel.Text = count.ToString();

if (count==0)

{

\_timer.Stop();

}

}

private void IncrementCounterClicked(object sender, EventArgs e)

{

count++;

TimerLabel.Text = count.ToString();

}

private void IncrementCounterClicked\_1(object sender, EventArgs e)

{



count+=5;

TimerLabel.Text = count.ToString();

}

private void ClearClicked(object sender, EventArgs e)

{



count = 0;

TimerLabel.Text = count.ToString();

}

}

}

**And my main page:**



<Label Text="00:00"

HorizontalOptions="Center"

FontSize="Title"

x:Name="TimerLabel"

TextColor="Silver"





\> </Label>

<Button Text="Start"

Clicked="OnTimedEvent"

FontSize="Body"

WidthRequest="80"

BackgroundColor="CornflowerBlue"

HorizontalOptions="Center"



\></Button>



<Button Text="+1"

Clicked="IncrementCounterClicked"

FontSize="Body"

WidthRequest="50"

BackgroundColor="CornflowerBlue"

HorizontalOptions="Center"



\></Button>



<Button Text="+5"

Clicked="IncrementCounterClicked\_1"

FontSize="Body"

WidthRequest="50"

BackgroundColor="CornflowerBlue"

HorizontalOptions="Center"

\></Button>



<Button Text="Clear"

Clicked="ClearClicked"

FontSize="Body"

WidthRequest="80"

BackgroundColor="CornflowerBlue"

HorizontalOptions="Center"

\></Button>

</StackLayout>

Ive really got no idea how to get it working or what to do. Im stuck and ive no idea where to find help
Viewing all 79144 articles
Browse latest View live


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