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

Xamarin.Forms.Forms doesn't exist after updating Xamarin.Forms

$
0
0

I was using this for the following implementations:

Xamarin.Forms.Forms.Init(...)
Xamarin.Forms.Forms.Context.GetSystemService(...)

However, since updating my android project to the latest version of Xamarin.Forms. The Xamarin.Forms.Forms namespace does not exist. Why would you remove a namespace like this? Where is the init method moved to? This is breaking my code and I can't build without this fixed.


How do we implement **Proctoring** in Xamarin forms? Is there any tool available for it?

xamarin forms android device database location

$
0
0

I can't find sqlite database in my project. In file folder there are no database. its empty. But my data is saving successfully and its loading. Please help

/data/user/0/com.companyname.MyApp/files/

This is my database path.

       var dbName = "dbApp.sqlite";
       var dbpath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);
       var path = Path.Combine(dbpath,dbName);
       var conn = new SQLiteConnection(path);

Draw numbers inside of a circle using SkiaSharp - Xamarin Forms

$
0
0

I want to create custom pins using SkiaSharp where I have a PinIcon.png which is simply a circle icon that's filled in with colour. I want to have numbers starting from 1 inside the pins, then add these numbered icons to the pins, and I figured that SkiaSharp was the best option. I cannot seem to draw on images using SkiaSharp, even though there is a lot of documentation.

I was thinking of something like below:

for( i = 1, i < pinlist.count, i++)
{
// numberedPin = PinIcon.Draw(i.ToString())
}

How to style shell content title and menu item title property in xamarin forms shell

$
0
0

Is it possible to set the font size and text color for menu items in xamarin forms shell? is styling possible for menu items /Shell items in xamarin forms shell?


<MenuItem Text="Help"
IconImageSource="help.png"
Command="{Binding HelpCommand}"

in the above code, how to style text property ?

Xamarin.Forms: Plugin.Geofence not showing notifications

$
0
0

I am using the https://github.com/CrossGeeks/GeofencePlugin Plugin.Geofence 1.5.4 nuget for Xamarin Forms trying to experiment with some geofences. Everything seems to work fine, but no notifications are showed on entry/stay/exit

` var request = new GeolocationRequest(GeolocationAccuracy.Medium);
var location = await Geolocation.GetLocationAsync(request);
Latitude = location.Latitude;
Longitude = location.Longitude;
CrossGeofence.Current.StartMonitoring(new GeofenceCircularRegion("My Region", Latitude,Longitude, 500)
{

                //To get notified if user stays in region for at least 5 minutes
                NotifyOnStay = true,
                NotifyOnEntry = true,
                NotifyOnExit = true,
                ShowNotification = true,
                ShowEntryNotification = true,
                ShowExitNotification = true,
                ShowStayNotification = true,
                Persistent = true,
                StayedInThresholdDuration = TimeSpan.FromMinutes(5)

            });`

Xamarin.Forms Tabbad Page on Android not working

$
0
0

Hello,
the error message is

System.InvalidCastException: 'Unable to convert instance of type 'Android.Widget.LinearLayout' to type 'Android.Support.Design.Widget.TabLayout'.'

everthing working fine on UWP, but on Android the App is crashing after the navigation.
Navigation works after I press a button

private void GoToTabPCommand() { Navigation.PushAsync(new NavigationPage( new TabPage())); }

Tried online solution like deleting .bin Folder and obj. Folder.
Xamarin.Android.Support.Animated.Vector.Drawable 28.0.0.3
Xamarin.Android.Support.Vector.Drawable 28.0.0.3
Xamarin.Forms Tried 4.4.0.991537 (highest current stable version)
also 4.3 ... 4.2 (different Versions)

Android is a physically Phone current with API 29

How to mark an area as Home/Safe zone on Google map?

$
0
0

Hi everyone,
I am working on an app in which I need to mark an area as Home/Safe on google map. I am really confuse which method should I use . I did some R&D but didn't find any exact way to do that.
For example suppose when we enter into the house we can mark that area as Home on google map and it will show the whole area of the house length and width of the house on google map which has been mark as home.

xamarin


Find a control inside ContentPage.Resources by name not index

$
0
0

Hi,

I have the following ContentPage.Resources inside my ContentPage:

<?xml version="1.0" encoding="utf-8" ?>
<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"
    xmlns:SyncfusionBusyIndicator="clr-namespace:Syncfusion.SfBusyIndicator.XForms;assembly=Syncfusion.SfBusyIndicator.XForms"
    xmlns:SyncfusionInputLayout="clr-namespace:Syncfusion.XForms.TextInputLayout;assembly=Syncfusion.Core.XForms"
    xmlns:SyncfusionButtons="clr-namespace:Syncfusion.XForms.Buttons;assembly=Syncfusion.Buttons.XForms"
    xmlns:FFImageLoading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
    xmlns:SyncfusionMaskedEdit="clr-namespace:Syncfusion.XForms.MaskedEdit;assembly=Syncfusion.SfMaskedEdit.XForms"
    xmlns:SyncfusionPicker="clr-namespace:Syncfusion.SfPicker.XForms;assembly=Syncfusion.SfPicker.XForms"
    mc:Ignorable="d" BackgroundColor="White"
    x:Class="Angels.Signup">
    <ContentPage.Resources>
        <ResourceDictionary>
            <ContentView BackgroundColor="White" x:Key="ActivationPINContentView">
                <StackLayout x:Name="StackLayoutActivationPIN">
                    <Grid x:Name="GridActivationPIN" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Padding="15">
                        <SyncfusionInputLayout:SfTextInputLayout Hint="Activation PIN" Margin="0,0,0,10" ContainerType="Outlined">
                            <SyncfusionMaskedEdit:SfMaskedEdit x:Name="MaskedEditActivationPIN" ValidationMode="KeyPress" FontSize="Medium" HeightRequest="60" MaskType="Text" Mask="0  0  0  0  0  0" ValueMaskFormat="ExcludePromptAndLiterals" CutCopyMaskFormat="ExcludePromptAndLiterals" HorizontalTextAlignment="Center" FlowDirection="LeftToRight" HorizontalOptions="FillAndExpand" Keyboard="Numeric" />
                        </SyncfusionInputLayout:SfTextInputLayout>
                    </Grid>
                </StackLayout>
            </ContentView>
        </ResourceDictionary>
    </ContentPage.Resources>
     ......................................................
     ......................................................
     ......................................................
     ......................................................

I am currently doing this:

contentView = (ContentView)Resources["ActivationPINContentView"];

stackEditor = contentView.Content as StackLayout;
gridEditor = stackEditor.Children[0] as Grid;
maskedEdit = (gridEditor.Children[0] as SfTextInputLayout).InputView as SfMaskedEdit;

But i want to ask is it possible to reach the MaskedEditActivationPIN by name instead of going through each layer..

So what I am looking for is something like this:

FindByName("MaskedEditActivationPIN");

Thanks,
Jassim

Page based On Device

$
0
0

If Device is tablet means, I want content page and if Device is phone means I want Master detail page. How to achieve it.Any suggestion please............

Store list of data

$
0
0

What is the most efficient way to store list of data? I will write values locally on the device each minute, and then I would like to perform searches/grouping on that data. The data is basically a List where T is a general POCO that holds a DateTime and some doubles. I will need to sort the data and so on. Is it best to just use a file on the device or SQLLite or something else? The storage would also need to be thread safe, i.e it might happen that my service writes to the list during search in it. In worst case the list will hold a few thousands of objects.

How read metadata with crossmediamanager in audio stream

$
0
0

public async void PlayStream()
{
var mediaItem = await CrossMediaManager.Current.Play("URL");
mediaItem.MetadataUpdated += (sender, args) => {
title = args.MediaItem.Title;
};
}
Everything works correctly with an mp3 file, while metadata is not received with a streaming stream. Why ?

Xamarin.Forms SOAP output style

$
0
0

Hi,
i call a soap 1.1 web service from my xamarin forms app (.netstandard 2.0). I generated the reference.cs file in my .android project. Then when i watch the request with fiddler, i see, there is a outcomming xml like this:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header />
    <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <q1:testMaterial xmlns:q1="example.com/testWS"><testMaterialRequest href="#id1" />
         </q1:testMaterial>
         <q2:testMaterialRequestType id="id1" xsi:type="q2:testMaterialRequestType" xmlns:q2="example.com/testWS">
            <DataArea href="#id2" />
         </q2:testMaterialRequestType>
         <q3:Array id="id2" xmlns:q4="example.com/testWS" q3:arrayType="q4:testMaterialRequestTypeTestWS[1]" 
          xmlns:q3="http://schemas.xmlsoap.org/soap/encoding/">
             <Item href="#id3" />
         </q3:Array>
         <q5:testMaterialRequestTypeTestWS id="id3" xsi:type="q5:testMaterialRequestTypeTestWS" xmlns:q5="example.com/testWS">
           <ItemBarcode xsi:type="xsd:string">0036400780070001</ItemBarcode>
           <MachineBarcode xsi:type="xsd:string">2342423</MachineBarcode>
         </q5:testMaterialRequestTypeTestWS>
    </soap:Body>
</soap:Envelope>

When i call the same web service from a windows forms project (.net framework 4.7) i got a request xml like this:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <testMaterial xmlns="example.com/testWS">
        <reportthrombexinRequest xmlns="">
          <DataArea><testWS>
            <ItemBarcode>0036400780070001</ItemBarcode>
            <MachineBarcode>2342423</MachineBarcode>
          </testWS>
          </DataArea>
        </testMaterialRequest>
        </testMaterial>
      </soap:Body>
</soap:Envelope>

I see, xamarin (respectively mono) generate a soap 1.1 message with using multible references like href... and id... .
Is there a way xamarin to say that it will generate a request without using "multible references" like .netFramework?

Calendar Events not working properly in MS Graph API ???

$
0
0

Hi,

I am working on Outlook Calendar Events integration using Microsoft Graph Api in Xamarin forms. Also, i have done with the Authentication part
but i have some queries related to fetching of Calendar Events.

Q. I am able to fetch Calendar Events through my code , but its limited to "10" events only. I am not able to fetch all my outlook calendar events.

   Client = new GraphServiceClient("https://graph.microsoft.com/v1.0/",
                      new DelegateAuthenticationProvider(async (requestMessage) =>
                      {        
                          requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", authResult.AccessToken);                         
                      }));
                var events = await Client.Me.Calendar.Events.Request().GetAsync();                            
                var appointmentList = events.ToList();
                foreach (var appointment in appointmentList)
                {
                    Random randomTime = new Random();
                    Meetings.Add(new Model.Meeting()
                    {
                        From = Convert.ToDateTime(appointment.Start.DateTime).ToLocalTime(),
                        To = Convert.ToDateTime(appointment.End.DateTime).ToLocalTime(),
                        EventName = appointment.Subject,
                        Color = colorCollection[randomTime.Next(9)]
                    });
                }``

Can anyone help me out to fetch all the calendar events??

Thanks.

iOS Simulator in Windows or Linux?

$
0
0

Is there any source from where i can get iOS simulator for testing of my app? Thanks in advance.


ListView ItemsSource Binding in XAML Problem

$
0
0

when i change SelectedIndexChanged from picker i get data from Api to fill ListView but not Wotking
i try with & without fody.
SelectedIndexChanged is a behavoir picker

I use :
xamarin froms : 4.4.0.991537 v
PropertyChanged.Fody : 2.5.13 v

Listview Code :

                  <ListView  x:Name="RolesList" Margin="0,10,0,0"   ItemsSource="{Binding RolesUsers}">
                          <ListView.ItemTemplate>
                               <DataTemplate>
                                  <ViewCell>
                                        <StackLayout Orientation="Horizontal">
                                          <CheckBox HorizontalOptions="Start" IsChecked="{Binding IsSelected}" />
                                         <Label  HorizontalOptions="Start" Text="{Binding Name}" TextColor="Red" FontSize="13" />
                                         </StackLayout>
                                </ViewCell>
                              </DataTemplate>
                            </ListView.ItemTemplate>
                            <ListView.Footer>
                                 <StackLayout Padding="5,5,5,5">
                                      <Button
                                       BackgroundColor="Green"
                                          BorderRadius="5"
                                    Command="{Binding AddCommand}"
                                         CommandParameter="{Binding RolesUsers}"
                                       Text="Sauvegarder"
                                         TextColor="White"
                                        VerticalOptions="Center" />
                                </StackLayout>
                           </ListView.Footer>
                       </ListView>

ViewModel:

 public class ManagerRolesViewModel : BaseViewModel
    {

        public List<UserInfo> UserInfos { get; set; }

        public UserInfo SelectedUser { get; set; }
        public bool ListRolesVisibility { get; set; }
        public ObservableCollection<RoleForCheckBox> rolesUsers;


        public ObservableCollection<RoleForCheckBox> RolesUsers
        {
            get => rolesUsers;
            set => SetProperty(ref rolesUsers, value);
        }

        public ManagerRolesViewModel()
        {
           // this.TestCommand.Execute(null);

        }
        public ManagerRolesViewModel(string userId)
        {
            this.GetRolesByUserCommand.Execute(userId);
        }
        public override async void OnAppearing()
        {
            base.OnAppearing();

            this.GetUsersAndRolesCommand.Execute(null);
        }


        public ICommand GetRolesByUserCommand
        {
            get
            {
                return new Command<string>(async (userId) =>
                {
                    var result = await Api.GetListRolesByUsers(userId);
                    RolesUsers = result.data;
                    ListRolesVisibility = true;
                });
            }
        }
    }
}

PickerViewBehavior :

public class PickerViewBehavior : Behavior<Picker>
    {

        protected override void OnAttachedTo(Picker bindable)
        {
            bindable.SelectedIndexChanged += Bindable_SelectedIndexChanged;
        }

        protected override void OnDetachingFrom(Picker bindable)
        {
            bindable.SelectedIndexChanged -= Bindable_SelectedIndexChanged;
        }

        void Bindable_SelectedIndexChanged(object sender, EventArgs e)
        {
            UserInfo selectedUser = ((Picker)sender).SelectedItem as UserInfo;
            if (selectedUser == null)
            {
                ((Picker)sender).SelectedItem = null;
                return;
            }
            var vm = new ManagerRolesViewModel();
            vm.GetRolesByUserCommand.Execute(selectedUser.UserId);

        }
    }

XF-Material

$
0
0

hi
Is it supported? XF-Material in uwp?

FlyoutHeader doesnot display a ContentView page

$
0
0

i am new to xamarin forms, i'm learning about Shell. i try to display a content view inside a shell flyout header but it doesnot display.
This is the shell page

<?xml version="1.0" encoding="utf-8" ?>
<Shell
    x:Class="XamarinShell.AppShell"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:controls="clr-namespace:XamarinShell.Controls"
    xmlns:d="http://xamarin.com/schemas/2014/forms/design"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:views="clr-namespace:XamarinShell.Views"
    HeightRequest="200"
    mc:Ignorable="d">
    <Shell.FlyoutHeader>
        <controls:FlyoutHeader/>
    </Shell.FlyoutHeader>
    <FlyoutItem Title="Phone Call" Icon="icons_phone.png">
        <ShellContent ContentTemplate="{DataTemplate views:PhoneCallPage}" />
    </FlyoutItem>
    <FlyoutItem Title="Settings" Icon="icons_settings.png">
        <ShellContent ContentTemplate="{DataTemplate views:SettingsPage}" />
    </FlyoutItem>
</Shell>

This is the header view

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="XamarinShell.Controls.FlyoutHeader"
    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">
    <ContentPage.Content>
        <Grid BackgroundColor="Black" HeightRequest="200">
            <Image
                Aspect="AspectFill"
                Opacity="0.6"
                Source="xamarinstore.jpg" />
            <Label
                FontAttributes="Bold"
                HorizontalTextAlignment="Center"
                Text="Animals"
                TextColor="White"
                VerticalTextAlignment="Center" />
        </Grid>
    </ContentPage.Content>
</ContentPage>

Problem with my First XF Nuget Package

$
0
0

Hi,

I am trying to create a Nuget package to be used for my Xamarin Forms apps.

I am just starting a simple package to DisplayAlert like this:

private void Button_Clicked(object sender, EventArgs e)
{
    OneID.Signin.Log("Hello");
}

but I am getting:

System.NullReferenceException: 'Object reference not set to an instance of an object.'

My Nuget is created as a .NET Stranded Library Class, then I added a Signin Class file like this:

using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;

namespace OneID
{
    public class Signin
    {
        private static Page page;

        public static void Log(string text)
        {
            page.DisplayAlert("Test", "Ok", "Yes");
        }
    }
}

so Why I am getting the NullReferenceException error?

Thanks,
Jassim

iOS 13.0 Broke MasterDetailPage on iPads?

$
0
0

I have noticed that after updating iOS to v13.0, the MasterDetailPage is broken on iPads but it's still working on iPhones and Androids.
By broken I mean the whole page is white, without content.


The only way to fix this is to update Xamarin.Forms to the latest v4.2+.

The problem is that some other packages are not compatible (XF broke something else after v4.0) so I cannot update XF yet.
The App Store is rejecting my app because it shows a white screen on iPads with iOS 13.0+....so I would have to stop targeting iPads!

Try for yourself, here is a basic sample repo with MasterDetail page (the default Xamarin Forms template with MasterDetailPage).
https://github.com/stesvis/MasterDetailTest2

The same happens with Prism MasterDetailsPage:
https://github.com/stesvis/MasterDetailTest

  • iPhones: works
  • iPad -> iOS 12.2: works
  • iPad -> iOS 13.0: white screen

Any solution for this HUGE headache?

Viewing all 77050 articles
Browse latest View live


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