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

Maps

$
0
0

Hi to all the experts here,

I just would like to ask if anyone has an idea of how to bind the Map in viewmodel. I am using viewmodel in the customMap, but I don't know how to add command on MapClicked event in viewmodel. here is my code:

In View:
`

                <maps:Map.ItemTemplate>
                    <DataTemplate>
                        <maps:Pin Position="{Binding PositionJam}"
                            Address="{Binding Address}"
                            Label="{Binding Description}" />

                    </DataTemplate>
                </maps:Map.ItemTemplate>
            </local1:CustomMap>

`


Setting the style for a custom control in code behind to a styles file

$
0
0

How would I set the style for a custom control in code behind, but I want to access the style from a style file that is being specified.

This is my control:

    public class TestControl : StackLayout
    {
        public TestControl()
        {
        }

        public static readonly BindableProperty ShowThisProperty =
            BindableProperty.Create(nameof(ShowThis), typeof(bool), typeof(TestControl), default(bool),
                BindingMode.Default, null);

        public bool ShowThis
        {
            get => (bool)GetValue(ShowThisProperty);
            set => SetValue(ShowThisProperty, value);
        }


        protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            base.OnPropertyChanged(propertyName);

            if (propertyName == nameof(ShowThis))
            {
                for (int i = 0; i < 10; i++)
                {
                    var label = new Label()
                    {
                        Text = "Hello Control",
                        //Style = (Style)Application.Current.Resources["newLabelStyle"]
                    };

                    Children.Add(label);
                }
            }
        }
    }

I can set the style directly for the controls in the control like label like so: Style = (Style)Application.Current.Resources["newLabelStyle"]

But I want to pull the style from the styles file that is in the caller view. Here is my caller View with the styles file in resources.

<ContentPage.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <theme:style />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</ContentPage.Resources>

<ContentPage.Content>
    <StackLayout>
        <controls:TestControl ShowThis="True" />
    </StackLayout>
</ContentPage.Content>

Startup tracing cause Exceptions?

$
0
0

The release mode that use the startup tracing which create the custom.aprof causes an exception and the APP crashes.

In the debug mode all works fine.

why?

can not start the android .

$
0
0

Here is the log
[guu.medicalboo] Not starting debugger since process cannot load the jdwp agent. [libc] Access denied finding property "persist.vendor.sys.activitylog" [re-initialized>] type=1400 audit(0.0:14334): avc: denied { read } for name="u:object_r:mtk_amslog_prop:s0" dev="tmpfs" ino=15542 scontext=u:r:untrusted_app:s0:c191,c257,c512,c768 tcontext=u:object_r:mtk_amslog_prop:s0 tclass=file permissive=0 [monodroid] Creating public update directory:/data/user/0/com.mcguu.medicalbook/files/.__override__[monodroid] Using runtime path: /data/app/com.mcguu.medicalbook-32zAow9QLBt8C7tpCFMn5A==/lib/arm64 [monodroid] Initializing profiler with options: aot:port=9999,output=/data/user/0/com.mcguu.medicalbook/files/.__override__/profile.aotprofile [monodroid] The 'aot' profiler wasn't found in the main executable nor could it be loaded from 'libmono-profiler-aot.so'. [monodroid-gc] GREF GC Threshold: 46080 [DecorView] It support bigbang

Send Notification to Certain Mobile Users - Xamarin App

$
0
0

Hi All,

Good Day!

We are working on a reservation system mobile application. The Dispatcher can assign trips to the driver. The Application is created using Xamarin Forms. We need the related drivers to get notified before the trip starts (2 Hours Before, 30 Min before the Trip).

Kindly advise how to achieve this

Xmarin Shell Bottom Tab Bar Only Icons Available

$
0
0

Hi all, with reference to my below XAML implantation of shell

    <Shell.FlyoutHeader>
        <Grid BackgroundColor="#171642" HeightRequest="200">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="10"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="20"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="150"/>
                <RowDefinition Height="0"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="10"/>
            </Grid.RowDefinitions>

            <Image Source="https://www2.utar.edu.my/main2014/utar2019.png" Aspect="Fill" Grid.Row="0"  Grid.ColumnSpan="4" WidthRequest="200" HeightRequest="150"  />

            <Label
              Grid.Column="1"
              Grid.Row="2"
              Grid.ColumnSpan="3"
              Text="Resource Booker Mini"
              TextColor="White"
              FontAttributes="Bold"
              Style="{DynamicResource SubtitleStyle}"/>
        </Grid>
    </Shell.FlyoutHeader>


    <FlyoutItem Title="Resource Booker"
                FlyoutDisplayOptions="AsMultipleItems" >

        <ShellContent Title="Main"
                      Icon="overview.png"
                      ContentTemplate="{DataTemplate views:MainPage}">

        </ShellContent>

        <ShellContent Title="MyBookings" 
                      Icon="booking.png"
                      ContentTemplate="{DataTemplate views:MyBookings}">
        </ShellContent>

        <ShellContent Title="Make A Booking"
                      Icon="create_booking.png"
                      ContentTemplate="{DataTemplate views:Make_Bookings}">

        </ShellContent>

        <ShellContent Title="My Calendar"
                      Icon="calendar.png"
                      ContentTemplate="{DataTemplate views:MyCalendar}">

        </ShellContent>

        <ShellContent Title="Explore"
                      Icon="explore.png"
                      ContentTemplate="{DataTemplate views:ResourceTypes}">

        </ShellContent>
    </FlyoutItem>

    <MenuItem Text="Admin Module" IconImageSource="admin.png"></MenuItem>
    <MenuItem Text="Help" IconImageSource="help.png"></MenuItem>

</Shell>

I am interested to know is it possible for me to hide the Text in the Bottom Tab Bar while having it remain on the left navigation ? Any humble suggestion please ?

Testing app upgrades

$
0
0

How do people testing the upgrading of their xamarin apps.

Take this situation as an example, I have an app that was released as version 1.9.2 on April 30th 2020. I am working in a branch and "deploying" that work in progress via Visual Studio 2019. I want to check how my new code will work on a device that comes to it from 1.9.2.

  • Can Visual Studio cope with that scenario?
  • Is the app ipa for 1.9.2 (in the case of iOS) all i need or is that released version of the app seen as a different app on the device?
  • Do people here keep their version numbers updated in the info.plist and AndroidManifest? We currently only update them at release time and those changes do not get checked into the repo.

How to access WPS notifications received by the UWP application?

$
0
0

Following this MSD I have implemented WPS push notification support for my UWP application. In the case of Android, we have a

public override async void OnMessageReceived(RemoteMessage message)

method which is going to capture the pushed FCM notification and we are able to add Pending intents and have functionalities like navigating to a specific page on tap of a certain notification implemented. Likewise in the case of iOS, we have a

[Export("userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:")]
public void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)

to intercept any notification interaction from the user, such as taps, or action button interaction and handle them accordingly.

In UWP, we have a

toast.Activated

event, to which we can assign a handler to do whatever is it we want to achieve when the ToastNotification is interacted with.
Unfortunately, this requires me to actually create a ToastNotification to be able to assign an event handler to it.

But as stated in the Microsoft documentation, I need not have any method to intercept the push notification and create a ToastNotification. The Push notification banner is automatically displayed.

How do I capture the notification tapped by the user? As I will require to navigate to certain pages based on the notification tapped.


The certificate for this server is invalid

$
0
0

I am getting the following exception when accessing iCloud storage from Xamarin.Forms iOS app. It works fine on simulator, the problem only on iPhone.

SIGABRT: <CKError 0x28114b960: "Network Failure" (4/NSURLErrorDomain:-1202); "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “gateway.icloud.com” which could put your confidential information at risk."

Do you have any idea how to resolve this exception?

I have tried to enable the NSAllowsArbitraryLoads, but no luck.

I am happy to provide any other information regarding this case.

Thanks,
Prabakaran

WebView difficulties

$
0
0

I am new to Xamarin and am trying to port an application that I once wrote for Windows Phone to Android, iOS and eventually Duo.
I have an html page that i need to display. There is embedded JavaScript in the html. In Windows Phone, once the page was loaded, I was able to execute the code with the following:
webBrowser.IsScriptEnabled = true;
webBrowser.InvokeScript("InitPage", dayOfWeek.ToString()....)
where "InitPage" is a function inside the html document.

(I am using the same html file for this app - I would would rather not change it if not necessary)
I have decided to use WebView to display the html.
I have added a callback: webView.Navigated += WebView_Navigated;
and in the callback, I think i need to call EvaluateJavaScriptAsync

I cannot figure out how to call the InitPage method and pass the required params with it.

ALSO, I can't seem to get the view to scroll.

Am I using the wrong control? I would appreciate any help in getting me past this roadblock
thanks

How do I bundle a large audio file without long start-up time?

$
0
0

So, here is a question I thought I'd find a quick answer to but so far haven't.

I have to include a fairly large (55-minute, 75MB) MP3 file in my application. What is the best way to do this without hitting start-up time too hard?

For now, I am focused on iOS but I imagine I am going to need to address this soon on Android.

I'm not noticing a huge start-up time but it would be nice to improve performance if I can.

Crashed when splash screen closed in android?

$
0
0

In Xamarin.forms android .it crashed when the splash screen close and the MainActivity start.

It works well in the emulator.

I add the the app-center to test it there is the crash log:

AppCenter.UITest.Android.Tests.AppDoesLaunchSystem.Net.WebException : POST Failed

I think it is because the net is not work.

how to find the exceptions?

Xamarin forms web view

$
0
0

Hello guys i had uploaded a xamarin forms apk consist only for webview but it rejected could any one tell me how i can uploade my PWA OR XAMARIN FORMS APP WITH webview to google play console

<ContentPage 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"
             mc:Ignorable="d"
             x:Class="LeenStoreApp.MainPage">


    <WebView Source="www.google.com" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"  />

</ContentPage>

Is it possible to implement device specific functionality in the shared code part of a project?

$
0
0

I'm working on an app with complex mapping features targeting Android and UWP, and have found the standard Xamarin tools to be woefully inadequate, particularly the UWP side.

With this in mind, I'm currently only going to focus on Android, where the stuff being used requires the full scope of what's available, i.e. polygons, polylines, drag/drop pins and long press functionality (why does Xamarin still not support these latter two things?!?!).

Is it possible to instantiate a map, in the shared code, using the standard Xamarin maps tools, and then tell it to utilise the specific functionality that Android offers? i.e. Draw a map, do all the polygon/polyline bits that work across all platforms, then tell it, "if device == Android, also implement long press and drag/drop in the following code". Perhaps using pre-processor directives.

Or will I need to write a completely separate and full implementations of the mapping logic in the respective Android and UWP projects within the solution?

Thanks (and sorry if this is quite simple, I haven't had to deal with writing device specific code before).

What all tools are present for measuring app performance ?

$
0
0

I want to measure my app performance but not sure about the tools available for it. Xamarin profiler is something I came accross but it is supported on visual studio enterprise edition. Can someone guide me how to use other tools for measuring app performace if available?


How do I place the tabbed page in the middle of the page?

$
0
0

Hi everyone !

I do not use a navigation bar on my screens by design. Instead, I have my own components at the top of the screen. For ex , Stacklayout,Custom menu ıcon etc. I want to use a tabbed page on my screen. But I can't place the xf tabbed page in the middle of my screen or under my own header.

Is there any way I can do this? Or is there a nuget package that you would recommend to me and it would work?

Thanks in advance !

Remove an image background and make it transparent.

$
0
0

Hi,

I wish to edit an image and remove its background and so make its background transparent I have done a lot of research and looked at Telerik's and Syncfusion's image editor controls. Unfortunately neither support image background removal.

There are a few XF image editing projects on GitHub that I have looked at but they do not support this feature.

Do you have any suggestions?

Thanks

SurfRat.

Add a background image to a layout or view

$
0
0

Hello, I noticed it doesn't exist the possibility to add a background image to a layout (i.e. StackLayout) or to a view (i.e. Form).
Is it possible? Is there a technical problem to add this feature? If so how I can solve the problem?
Thanks.

Add background image to a Layout or to a View

$
0
0

Hello, I noticed it doesn't exist the possibility to add a background image to a layout (i.e. StackLayout) or to a view (i.e. Form).
Is it possible? Is there a technical problem to add this feature? If so how I can solve the problem?
Thanks.

Azure Active Directory integration error The given key 'app_link' was not present in the dictionary

$
0
0

I am integrating Azure Active Directory in my Xamarin Forms project.. as of now i am testing my app for Android. After click on login button i am successfully able to launch login page of microsoft portal but when user logged in after entering their email and password i got The given key 'app_link' was not present in the dictionary exception in my app.

Please suggest any solution..

Viewing all 89864 articles
Browse latest View live