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

How to handle click on Map in Xamarin Forms?

$
0
0

I want to click on Map and get that Long/Lat point. How to handle click on Map in Xamarin Forms?
Thank you!


Still no xaml designer?

$
0
0

Just a short question - as I am aware xaml designer was unavailable for forms. Some new releases came since then so I just want to make sure - still no xaml designer?

Defining Font with StaticResource at Xamarin.Form > 2.4

$
0
0

Hi,

I am upgrading my Xamarin.Form from 2.3, but it seems that there are some changes in Font.

I have this in my App.xaml

<OnPlatform x:TypeArguments="Font" x:Key="FontAwesomeBar">
    <OnPlatform.iOS>
        <Font FontFamily="FontAwesome" FontSize="24" />
    </OnPlatform.iOS>
    <OnPlatform.Android>
        <Font FontFamily="FontAwesome" FontSize="28" />
    </OnPlatform.Android>
</OnPlatform>

<Style x:Key="TopBarButtonStyle" TargetType="Button">
    <Setter Property="TextColor" Value="White"/>
    <Setter Property="Font" Value="{StaticResource FontAwesomeBar}"/>
    <Setter Property="BackgroundColor" Value="Transparent"/>
    <Setter Property="WidthRequest" Value="35"/>
    <Setter Property="VerticalOptions" Value="Center"/>
    <Setter Property="HorizontalOptions" Value="Center"/>
</Style>

I received this error message.
"Cannot assign property "FontFamily": Property does not exists, or is not assignable, or mismatching type between value and property"

I looked out their release note, and turned out they changed Font to FontElement
https://github.com/xamarin/Xamarin.Forms/pull/799

But I could not figured out how to solve this. When I tried to change Font to FontElement, I received this error.
"Default constructor not found for type Xamarin.Forms.FontElement"

Anyone had the same problem?

Start with Android System

$
0
0

Does anyone know how to make an android app to start with the android system? This includes running in the background(main activity C# code).
Ive looked everywhere, but nowhere does it say in forums or docs about this(or im not searching correctly probably)

What is the Ideal Apk Size from Xamarin Forms ? And how to reduce it without force close ?

$
0
0

I Have Xamarin Forms App With 10 - 15 Page and when I Archive the Appliaction to get the Apk , it has very big size 72 MB so i search in the internet to get smaller size with linker. So i Activated the SDK Assemblies Only Linker and it reduce like half of the first Apk Size to 32 MB , because i'm not satisfied enough and want to my apk smaller i Activated SDK Linker And User Assemblies and the size got reduced to 22 MB and when i try to run it its always force close And i'm still feel not satisfied enough by the size of my APK . My Target is my Apk size will has 5-15 MB , And how do i Achive that is there 3rd Party tools to do that or is that the ideal size(32 MB) for Xamarin Forms Apk ? because i'm still think that very big size of Apk that only have 10-15 Page

Xamarin + WindowsAzure.MobileServices

$
0
0

Hi all together,
i have a SqlServer table up and running in my Office.

<WorkDate,FK_ProjectNumber,WorkKind,WorkTime> (FK_xx = ForeignKey)

I would like to syncronice these table to Azure and connect to them via MobilePhone and Tablet.

Problems:
a) my mobile devices should only contain entries for running Projects.
b) if a Project is finished, the WorkTime records should be disabled (NOT DELETED) on Azure and on the SQLServer in the Office.
c)CRUD operations shoud be performed on every device.
Is there any best practise or any good advice

Thanks in advance
Peter

Xamarin.Android - The type or namespace name 'App' could not be found

$
0
0

Being creating an app with Xamarin.Forms, it works fine on the Windows platform, however, when I try to run it on my Android phone via the Xamarin Live Player it presents an number of issues, such as the one stated on the title.

I have made no changes to Android files, so I don't know why these errors are appearing. Does anyone know how to solve this issue?

I have also attached the output.

I want to take backup and restore of SQLite Database file using xamarin Azure SDK for My Xamarin App

$
0
0

I am using xamarin Azure SDK to download and manage the local database for my Xamarin . Forms App.

We are facing downloading time issues because we have a lot of data.
so I am thinking of taking backup once of the SQLite File from one device and use it to restore on different devices as restoring the same SQLite File.

Planned to use Azure Blob storage to store backup of SQLite files and for different device planning to download that blob of SQLite file and thinking of restore it on different devices.

Any Help will be appreciated.

Thanks :)


Acr Userdialoges not working

$
0
0

Hi,
I have a strange problem.
In my login page, I am using Acr.UserDialogs. If I give the correct credentials userdialoges not work, but with wrong credentials, userdialoges working fine.
I am confused with this? Any idea :)
Thanks in advance :)

Frame doesn't have shadow

$
0
0

I'm using Frame in my page I set the hasShadow prop to true, still nothing shows

Loop through the dynamically created views in Xamarin.form

$
0
0

I just create some of the dynamic views in xamarin.fom . now i want to iterate through that views to identify the view type .how can i make it possible in xamarin.form
any help be appreciable ; please help me i am stuck.

Custom ViewCell with bindable custom object

$
0
0

I'm here with a question that is bothering me for the last couple of days and I was unable to find a clear explanation for. What I want to accomplish: Create a custom ViewCell of which BindableProperty is a complex object. A this moment I receive a null value in my BindableProperty. Any tip is of great help.

ViewCell's code behind:

`
public partial class ValidatableText : ViewCell
{
public static readonly BindableProperty BindedObjectProperty =
BindableProperty.Create(
nameof(ObjectToValidate),
typeof(ValidatableObject),
typeof(ValidatableText),
default(ValidatableObject));

    public ValidatableObject<string> ObjectToValidate
    {
        get
        {
            var value = GetValue(BindedObjectProperty);
            var result = value as ValidatableObject<string>;
            return result;
        }
        set
        {
            SetValue(BindedObjectProperty, value);
            OnPropertyChanged(nameof(ObjectToValidate));
        }
    }

    protected override void OnPropertyChanged([CallerMemberName]string propertyName = null)
    {
        if (!string.IsNullOrWhiteSpace(propertyName) && propertyName == BindedObjectProperty.PropertyName)
        {
            base.OnPropertyChanged(propertyName);
        }
    }

    public ICommand ValidateInput
    {
        get
        {
            return new Command(() =>
            {
                this.ObjectToValidate.Validate();
            });
        }
    }

    public ValidatableText()
    {
        InitializeComponent();
        BindingContext = this;
    }
}`

ViewCell's Calling:

<ContentPage.Content> <TableView Intent="Form" HasUnevenRows="True"> <TableRoot > <TableSection Title="Creditentials"> <cells:ValidatableText ObjectToValidate="{Binding Email}"> </cells:ValidatableText> </TableSection> </TableRoot> </TableView> </ContentPage.Content>

Caller's ViewModel:

`public ValidatableObject Email
{
get => _email;
set
{
_email = value;
this.OnPropertyChanged();
}
}

public RegisterUserViewModel()
{
this.Email = new ValidatableObject();
this.Email.Validations.Add(new EmailRule(){ValidationMessage = "Invalid email format"});
}

`

Kind regards!

GradientBoxView Custom renderer

$
0
0

I'm trying to recreate the gradient background effect from here:
https://forums.xamarin.com/discussion/22440/gradient-as-background-color

But instead of using it as page background I want to use it in a boxView, the problem is that IOS renders the colors into lighter versions, as if it has opacity values under 1 (or similar...)

For the common component I'm extending the boxview class adding it a two Xamarin.Forms.Color properties (StartColor and EndColor):

public class GradientBoxView : BoxView
{
    public Xamarin.Forms.Color StartColor { get; set; }
    public Xamarin.Forms.Color EndColor { get; set; }
}

The custom renderer class for IOS is this:

public class GradientBoxViewRenderer : BoxRenderer 
{
    public override void Draw (CGRect rect)
    {
        base.Draw (rect);
        this.Element.Opacity = 1;
        GradientBoxView box = (GradientBoxView)this.Element;

        CGColor startColor = box.StartColor.ToCGColor();//box.StartColor.AddLuminosity(1).MultiplyAlpha(2).ToCGColor();//
        CGColor endColor = box.EndColor.ToCGColor();//box.EndColor.AddLuminosity(1).MultiplyAlpha(2).ToCGColor();//

        var gradientLayer = new CAGradientLayer();
        //gradientLayer.Opaque = true;
        gradientLayer.Frame = rect;
        gradientLayer.Colors = new CGColor[] { startColor, endColor };
        //NativeView.Opaque = true;
        NativeView.Layer.InsertSublayer (gradientLayer, 0);
    }
}

Searching in the forum I did find someone having a similar issue with IOS topBar colors and the solution was setting "Opaque" to true and "Translucent" to false, but BoxView doesn't seems to have a Translucent property to play with and the "Opaque" one does nothing (at least I cant tell a difference by commenting/uncommenting the lines of my renderer where I play with it...)

Anyone here with the same issue or with any solution?

Dismiss AlarmClock

$
0
0

Hello I have a problem in Xamarin Forms (Visual Studio 2017) on Android.
I use AlacmClock Intent to create an alarm like this:
private void SetAlarmClock(int minutes, string message)
{
try
{
string ringtoneUri = App.UserSettings.GetSettings("RingtoneUri");
DateTime alarmTime = DateTime.Now;
alarmTime = alarmTime.AddMinutes(minutes);
Intent intent = new Intent(AlarmClock.ActionSetAlarm);
intent.PutExtra(AlarmClock.ExtraHour, alarmTime.Hour);
intent.PutExtra(AlarmClock.ExtraMinutes, alarmTime.Minute);
intent.PutExtra(AlarmClock.ExtraMessage, message);
intent.PutExtra(AlarmClock.ExtraSkipUi, true);

            if (!string.IsNullOrEmpty(ringtoneUri))
                intent.PutExtra(AlarmClock.ExtraRingtone, ringtoneUri);
            context.StartActivity(intent);
        }
        catch (Exception ex)
        {
            App.UserSettings.WriteProtocol("SetAlarmClock Exception: " + ex.Message);
        }
    }

But I have also method for dismiss this alarm but it don't work:
private void DismissAlarmClock(string message)
{
try
{
Intent intent = new Intent(AlarmClock.ActionDismissAlarm); // This Intent can be used only for API 23 and higher (Android 6.0)
intent.PutExtra(AlarmClock.ExtraAlarmSearchMode, AlarmClock.AlarmSearchModeLabel);
intent.PutExtra(AlarmClock.ExtraMessage, message);
intent.PutExtra(AlarmClock.ExtraSkipUi, true);
context.StartActivity(intent);
}
catch (Android.Content.ActivityNotFoundException)
{
App.UserSettings.WriteProtocol("DismissAlarmClock AlarmClock.ActionDismissAlarm is not supported on Android 5.1 and lower!");
}
catch (Exception ex)
{
App.UserSettings.WriteProtocol("DismissAlarmClock Exception: " + ex.Message);
}
}

Problem 1: it dismisses the alarm not always
Problem 2: Nevertheless I use intent.PutExtra(AlarmClock.ExtraSkipUi, true); it opens always Alarm/Watches App on Android.

I have seen some examples on internet with AlarmManager and PendingIntent but this also don't works in my App.
Thanks.

Is it possible to implement iOS App Extensions in a Forms app?


DidReceiveRemoteNotification, ReceivedRemoteNotification are not being called while using FCM

$
0
0

Hi everyone, I'm trying to impalement push notifications in Xamarin forms using this plugin, Plugin.FirebasePushNotification
im receiving the notifications but after clicking on notifications, DidReceiveRemoteNotification, ReceivedRemoteNotification are not being called. how can I get notifications info in app ?

Here is the code

        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

            LoadApplication(new App());

            FirebasePushNotificationManager.Initialize(options, true);


            return base.FinishedLaunching(app, options);
        }

        public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
#if DEBUG
            FirebasePushNotificationManager.DidRegisterRemoteNotifications(deviceToken, FirebaseTokenType.Sandbox);
#endif
#if RELEASE
                    FirebasePushNotificationManager.DidRegisterRemoteNotifications(deviceToken,FirebaseTokenType.Production);
#endif


            Console.WriteLine("deviceToken " + deviceToken);

        }

        public override void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error)
        {
            Console.WriteLine("error " + error);

            FirebasePushNotificationManager.RemoteNotificationRegistrationFailed(error);

        }
        // To receive notifications in foregroung on iOS 9 and below.
        // To receive notifications in background in any iOS version
        public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
        {

            Console.WriteLine("DidReceiveRemoteNotification calling ");

            System.Console.WriteLine("Hello");

            FirebasePushNotificationManager.DidReceiveMessage(userInfo);
            // Do your magic to handle the notification data
            System.Console.WriteLine(userInfo);
        }


 public override void ReceivedRemoteNotification(UIApplication application, NSDictionary userInfo)
        {

            Console.WriteLine("ReceivedRemoteNotification calling ");

            System.Console.WriteLine("Hello");

            FirebasePushNotificationManager.DidReceiveMessage(userInfo);
            // Do your magic to handle the notification data
            System.Console.WriteLine(userInfo);
        }

List view Item inside a box

$
0
0

I need to place list view items inside a box...
that means items placed inside a border...I tried with frame...It takes more space between the items and border...Any other idea to implement this
Thanks in Advance

How do I upload PDF/Docs in Xamarin form?

$
0
0

How do I upload PDF/Docs in Xamarin form? I am able to select and upload Image Files thought using MediaPicker though.

xam.Plugin.GeoLocator does not work

$
0
0

hi, I added xam.Plugin.GeoLocator inorder to get gps coordinates. But in Droid project I keep getting following error.

"java.lang.IllegalArgumentException: already added : Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat; Medarbeideren.Droid".
Did many solutions suggested. reinstalling nuget packages.change target API levels,etc. But the error is still the same. Any solutions for this?

UI Design

$
0
0

Hi guys,

Could you please suggest nice plugins for UI, or links on how to design my application...

The problem that I have, most of UI x stuff are for sale and they are pricey, more especially for us in Africa

Viewing all 58056 articles
Browse latest View live


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