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

Image is skewing in iPhone plus devices and XS Max devices for LaunchStoryBoard

$
0
0

HI Guy's,

I'm using LaunchStoryBoard for splash screen in my xamarin forms app. I used 2x,3x images even-though image is skewing in Plus devices and XS Max devices.

1) 2x Image Size - 750x1334
3x Image Size - 1242x2688(For XS Max used)
In this case Plus device is effecting
2) 2x Image Size - 750x1334
3x Image Size - 1242x2208(For Plus devices used)
In this case XS Max device is effecting

And also I tried by adding images in Assets also leads to the same.

In Assets I created Imageset and added the 1x,2x.3x images in iPhone Devices section.

Can you please help me with the above problem.
Thanks in advance.


Making colors.xml file in Xamarin.Forms

$
0
0

Hi,
In my Xamarin.Forms app at many places using colors. Is there any to keep those colors in separate file as we are doing in Android, There we are having colors.xml file like this i am looking in Xamarin.Forms

Xamarin UWP Map is blank

$
0
0

my maps on UWP is blank, just a black screen with the zoom buttons. i have given capabilities, put the init codes in the UWP app.xaml.cs.
HELP

How to pass a value from .xaml file to .xaml.cs file?

$
0
0

Hi I'm very new to Xamarin. I try to make a simple project. Here I'm using some binding method. but I can't fetch the value from the .xaml file to .xaml.cs file.
Please help or give me any reference for this issue. I used a button.... from that I used button_Clicked event to fetch the data. But I don't know and I can't find the solution for fetch the data in entry field of .xaml file to .xaml.cs file.

How make a circle label?

$
0
0

Hi, i have a list of label and i have to add into a label a text and then a counter. The counter must be a circle with a number in it.

This is the code of the counter:
<Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="6*" /> <ColumnDefinition Width="4*" /> </Grid.ColumnDefinitions> <cr:ExtendedLabel x:Name="InnerLabel" Grid.Column="0" FontSize="25" FontWeight="Normal" HorizontalOptions="FillAndExpand" HorizontalTextAlignment="End" TextColor="White" VerticalOptions="CenterAndExpand" VerticalTextAlignment="Center" /> <Label x:Name="Etichetta" Text="1" Grid.Column="1" HorizontalTextAlignment="Start"/> </Grid>
This code just to that...

Does anyone knows how to do that circle for the counter?

Thanks a lot

Xamarin - Entity Framework - SqLite - GetItemsAsync : unable to open database file

$
0
0

Xamarin - Entity Framework - SqLite : unable to open database file


In Visual studio 2017, I created a Cross-Platform Mobile App (Xamarin.Forms)

NETStandard 2.0
Microsoft.Data.Sqlite.Core 2.2.0
Microsoft.EntityFrameworkCore 2.2.0
Microsoft.EntityFrameworkCore.Sqlite 2.2.0
Microsoft.EntityFrameworkCore.Tools 2.2.0

I did a code first migration to Sqlite with Entity Framework. All tables are created successfully. The database was seeded.

When I try to get the ItemsViewModel (see code below), I get the following exception (after 20 seconds) on the line --> List item list1 = await db.Person.ToListAsync();

Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 14: 'unable to open database file'. at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db) at Microsoft.Data.Sqlite.SqliteConnection.Open() at System.Data.Common.DbConnection.OpenAsync(CancellationToken cancellationToken)

Strangely enough my method TestSqLiteDataStoreAsync (see code below) correctly returns the expected list of items.

Below you will find the relevant code. If you need anything more, let me know.


[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ItemsPage : ContentPage
{
    ItemsViewModel viewModel;

    public ItemsPage()
    {
        InitializeComponent();
        //1 code starts here
        BindingContext = viewModel = new ItemsViewModel();
    }

    async void OnItemSelected(object sender, SelectedItemChangedEventArgs args)
    {
        var item = args.SelectedItem as Item;
        if (item == null)
            return;

        await Navigation.PushAsync(new ItemDetailPage(new ItemDetailViewModel(item)));
        ItemsListView.SelectedItem = null;
    }

    async void AddItem_Clicked(object sender, EventArgs e)
    {
        await Navigation.PushModalAsync(new NavigationPage(new NewItemPage()));
    }


    //adding 'async' did not solve the problem
    protected async override void OnAppearing()
    {
        base.OnAppearing();

          if (viewModel.Items.Count == 0)
            //2 code continues here 
            viewModel.LoadItemsCommand.Execute(null);
    }
}



public class ItemsViewModel : BaseViewModel
{
    public ObservableCollection<Item> Items { get; set; }
    public Command LoadItemsCommand { get; set; }

    public ItemsViewModel()
    {
        Title = "Browse";
        Items = new ObservableCollection<Item>();

    //3 code continues here 
        LoadItemsCommand = new Command(async () => await ExecuteLoadItemsCommand());

        MessagingCenter.Subscribe<NewItemPage, Item>(this, "AddItem", async (obj, item) =>
        {
            var newItem = item as Item;
            Items.Add(newItem);
            await DataStore.AddItemAsync(newItem);
        });

    }

    //My test method
    public async Task<List<Item>> TestSqLiteDataStoreAsync()
    {
        SqLiteDataStore SqLiteDataStore = new SqLiteDataStore();
         return await SqLiteDataStore.GetItemsAsync(false);
    }



    async Task ExecuteLoadItemsCommand()
    {
        if (IsBusy)
            return;

        IsBusy = true;

        try
        {
            Items.Clear();
    //4 code continues here 
            var items = await DataStore.GetItemsAsync(true);
            foreach (var item in items)
            {
                Items.Add(item);
            }
        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex);
        }
        finally
        {
            IsBusy = false;
        }
    }
}

public class SqLiteDataStore : IDataStore
{
public string dbFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
public string fileName = "TestSqLite.db";

    public SqLiteDataStore()  { }

    public async Task<List<Item>> GetItemsAsync(bool forceRefresh = false)
    {
        try
        {
            using (var db = new Models.MyContext(Path.Combine(dbFolder, fileName)))
            {
                List<Person> list1 = new List<Person>();
                List<Item> list2 = new List<Item>();

                //5 I get the error here
                list1 = await db.Person.ToListAsync();

                foreach (Person person in list1)
                {
                    Item item = new Item(person);
                    list2.Add(item);
                }
                return list2;
            }
        }
        catch (Exception)
        {
            throw;
        }
     }


    public async Task<bool> AddItemAsync(Item item)
    {
       throw new NotImplementedException();
    }

    public Task<bool> UpdateItemAsync(Item item)
    {
        throw new NotImplementedException();
    }

    public Task<bool> DeleteItemAsync(string id)
    {
        throw new NotImplementedException();
    }

    public Task<Item> GetItemAsync(string id)
    {
        throw new NotImplementedException();
    }
}

Issue with Creating Card Connect SDK Xamarin binding Library for iOS

$
0
0

I created a Xamarin Binding Library project to map the card connect sdk for ios and was successful in it. But when I try to create a sample project to test the function its giving me the following error.

Could not create an native instance of the type 'CardConnect.CCCPaymentRequest': the native class hasn't been loaded. It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.

You can find the Objective C & Swift sample and documentation in the link below https://developer.cardconnect.com/mobile-sdks#iOS

Also I am trying to bind an Objective C framework library

How to avoid repetitive bindings of a list view in xamarin forms

$
0
0

Hi Team,

I am binding a list view(labels) having two columns Name and status(i.e. Default value is blank) in my home screen. And also I have few action buttons like Download,Delete.
User will select any record in the list view and click on download button. Now the status need to change as downloaded. Can we avoid the binding the entire list data and it should be specific to the selected row.Here is my code.
Please find the attachment.

Thanks,
Naveen.


Text to speech is not read when navigate to other screen or click on back button in Xamarin forms

$
0
0

Hi Guys,

I am Implemented Text to speech functionality using Xamarin forms Essentials package, Text to speech is not read when we navigate to other screen or click on back button.

I have 5 pages in my Application, suppose I am in SecondPage before reading speech content in the Second page when i navigate to third page or press back button Text to Speech is not working.

Can anyone help on this.

Thanks,
Srinivasu

Binding From list to labels and buttons from list

$
0
0

Hi , Im binding from my ViewModel to my view a list , but the client requested specific design , can I instead of binding to a list , bind data to labels and buttons that i have created by my self ! see picture to understand more what i mean .
thanks


Nested ListView in Xamarin.Forms (ListView inside another ListView)

$
0
0

I have created a nested ListView in Xamarin.
But unfortunately, the binding works only with the Parent ListView and NOT with the Child List - sub ListView.

I tried to verify if there is any error with my Binding, and my binding works well with the sub List, if i make it as parent.
Any help on this binding, or approach for nested ListView bindings in Xamarin with samples would be much helpful.

Application has horrible performance on Obi sf.

$
0
0

A client of my has a test phone called Obi sf1 with qualcomm msm8939 processor and android 5.0.2. My app performs well on most devices but I noticed a noticeable performance dip on that phone. The basic stuff starting with an entry and scroll do not work. There are not stuff running on background or any ui blocking tasks. Can some one please help me with this stuff ?

Disable "App scaling" / "Full screen prompt" on wide device.

$
0
0

I have a Xamarin.Forms application running on Android. When deployed to a Nokia 3.1 device this shows a "resize button" on the title bar when using the app switcher. When tapped this restarts the application.

The device shows the following description of this button:

App scaling.
Tap the button to optimize the app screen size. The apps will be reopened and some apps may not work well in full screen mode.

Other apps such as Chrome do not show this resize button in the app switcher, what functionality/flag do I need to add to my app to support the screen ratio of this device and cause this button to not appear?

I've also noticed something similar on a Samsung S9, when the app first starts there's a bar at the bottom that you tap on to restart the app to take up the full space on the screen, I imagine this is the same functionality, however on the Samsung it never asks you about this again whereas on the Nokia it's easily tapped which kills and restarts the app.

How to check a page is in the navigation stack or not?

$
0
0

How to check a content page already have on navigation stack or not in xamarin forms?

How do I change the text lineheight?

$
0
0

Hi guys,

I'm trying to change the lineheight of a label but I couldn't figure it out. Can somebody help me out?


Can I send a value to my Webapi not to be stored in database but as a parameter to return data

$
0
0

Hi All,

So I am using web api to post data to a database on the server.. work great easy to understand how its working...
But in this case.. the users want to be able to send and Id via their devices and have that Id get processed and
return a value back to a list display on the device...

So and web api get.. but with a parameter... Is there some example I can follow showing how this can be done...
I am sure this is more a question for web api people

But I wanted to check here first.. because I was not sure how to refresh the page on the device if this can be done.

Thanks.

Unable to build Xamarin Forms project to iOS with DevExpress XPO

$
0
0

Hi All,
I have posted this on StackOverflow, but to get maximum exposure I am asking here also.
Completely out of ideas.

As soon as DevExpress XPOCore is referenced in my XamarinForms application iOS refuses to build - All other platforms build fine. (Android and UWP)

I must add this issue is apparent when building to my iPad and with the simulator.

All packages selected are latest stable.

I am using the lastest community edition of Visual Studio on windows, which connects to a Mac Mini running the latest macOS (Mojave)

The issue is also apparent when I try to build the DevExpress demos.

As XPO is a free nuget package - I can not ask DevExpress directly for support.

The error message return in visual studio is -

Failed to resolve "System.Drawing.Image" reference from
"System.Drawing.Common, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51" DevExpress.Xpo.XamarinFormsDemo.iOS
C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets
From output

1> C:\Program Files (x86)\Microsoft VisualStudio\2017\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(795,3):
error MT2002: Failed to resolve "System.Drawing.Image" reference from
"System.Drawing.Common, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51"
1>
1> 2 Warning(s)
1> 1 Error(s)
Edit - checked on Mac in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Facades - and System.Drawing.Common exists already.

I do not have enough rep to post any links to anything I have referenced.

Appreciate any help, thanks.

Is there full support for xamarin form platforms wpf

$
0
0
I am developing wpf application using xamarin forms. I am facing lot of issues while implmentating the every feature. For example camera functionality is not supported to xamarin form platforms wpf.
When I used native wpf camera, the camera UI is showing another window.
Is it possible to make camera functionality in xamarin forms platforms wpf.

Thanks in advance

Tapping on Entry in ListView doesn't select the ListView row

$
0
0

I have a Label and an Entry in a ListView, however, when I tap any given Entry in the ListView, it does not select the ListView row that contains that tapped Entry. When I tap a Label, the selected ListView row is correctly changed. Is there a known workaround for this? I need the selected ListView row to change to the row containing the Entry that receives focus.

Sample Hello Android Quickstart -Create Second copy with another name Question

$
0
0

Can I create a SECOND copy of the Hello Android Quickstart if I use a different NAME and a different Solution Name? Would that cause any problems?

Viewing all 91519 articles
Browse latest View live


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