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

How to uncheck other checkbox's when one checkbox is checked in a group?

$
0
0

How to uncheck other checkbox's when one checkbox is checked in a group, Like acting like a radio button group?


Async UI event handlers - So now all my event handlers are re-entrant?

$
0
0

Question - We have implemented async/await in our UI event handlers, now we have the problem that if users mash on the UI they can re-enter our event handlers before they have completed because there are await's in the event handlers.

Now we have the problem of having to either display a busy indicator over the entire UI surface blocking all user input or implementing a flag that has to be checked by all UI event handlers.

There seems to be no other way to deal with this issue, specifically nothing baked into the Xamarin Forms API??

Binding source url video with plugin Global.Video Player

$
0
0

How can I make the url of my video that I have for binding come out in my view.

Do not put the static url, but bring the url record in a list, and the video appears playing.

And when I put the static link, if the video appears.
I am using a carouselView with an ObservableCollection

Implement system like OnPlatform/OnIdiom

$
0
0

Hi,
I need to bind to a different property depending on the language of my app.
I would like to do this by XAML and was inspiried by OnPlatform/OnIdiom.

So I created something like OnIdiom but for Languages, but I have no clue how to make it accessible in any content in XAML.

using ThibertApp.Resources;

namespace ThibertApp.Localization
{
    public class OnLanguage<T>
    {
        T _EN;
        T _FR;
        bool _isENSet;
        bool _isFRSet;

        public T EN
        {
            get => _EN;
            set
            {
                _EN = value;
                _isENSet = true;
            }
        }

        public T FR
        {
            get => _FR;
            set
            {
                _FR = value;
                _isFRSet = true;
            }
        }

        public static implicit operator T(OnLanguage<T> onLanguage)
        {
            switch (AppResources.Culture.TwoLetterISOLanguageName)
            {
                default:
                case "en":
                    return onLanguage._isENSet ? onLanguage.EN : default(T);
                case "fr":
                    return onLanguage._isFRSet ? onLanguage.FR : default(T);
            }
        }
    }
}
<?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:s="clr-namespace:ThibertApp.Resources"
             xmlns:l="clr-namespace:ThibertApp.Localization;assembly=ThibertApp"
             x:Class="ThibertApp.Pages.HomePage"
             Title="{Binding Title}"
             IconImageSource="{Binding IconImageSource}"
             BackgroundColor="White"
             Style="{StaticResource ThibertPage}">
    <ContentPage.Content>
        <StackLayout Margin="10">
            <Frame CornerRadius="10"
                   BackgroundColor="{StaticResource ThibertGrey}">
                <Entry Placeholder="{Static s:AppResources.SearchPlaceholder}">
                    <Entry.Text>
                        <l:OnLanguage EN="{Binding TextEN}" FR="{Binding TextFR}"/>
                    </Entry.Text>
                </Entry>
            </Frame>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

When I reference my class and attempt to enter values it gives those errors.

Severity    Code    Description Project File    Line    Suppression State
Error   XLS0504 Property 'Text' does not support values of type 'OnLanguage'.   ThibertApp  HomePage.xaml   17  
Severity    Code    Description Project File    Line    Suppression State
Error       Position 17:26. Type l:OnLanguage not found in xmlns clr-namespace:ThibertApp.Localization  ThibertApp  C:\Users\william_d\source\repos\ThibertApp\ThibertApp\ThibertApp\Pages\HomePage.xaml    17  

Does anyone have any guideline as to how to make this possible? I've cloned Xamarin Forms and looked for reference to OnIdiom/OnPlatform and didn't find much that could answer my questions.

Thank you very much

Data binding controls in C# code

$
0
0

i have been searching for data binding but instead of being in xaml i am searching for being in .cs file, is there a manner (property) that allows me to bind the specific property to a variable?

App Store Connect (Application Loader) publishing failed - Failed to parse altool output.

$
0
0

I'm getting an error when trying to publish an update to my app using the Application Loader on VS. I tried researching on the error but the error itself isn't really clear. It originally worked earlier, but I got a "missing Info.plist value. CFBundleIconName is missing in the bundle" so I simply migrated to asset catalog (didn't use asset catalog for icons before) and now I'm getting this error. I cannot copy and paste the error but a picture of the error can be found below.

What is the most efficient chat api provider that integrates best with Xamarin?

$
0
0

I am wondering which chat API/server provider is most efficient, understandable, cost effective, and easily integrated with Xamarin - the following list:

1.) Buddy - https://buddy.com/
2.) Google Cloud Messaging - https://developers.google.com/cloud-messaging/
3.) QuickBlox - https://quickblox.com/
4.) PubNub - https://www.pubnub.com/
5.) Socket.io - http://socket.io/
5.) Firebase - https://www.firebase.com/
6.) GameSparks - http://www.gamesparks.com/
7.) ShepHertz - http://www.shephertz.com/
9. )Apiomat - https://apiomat.com/en/

Create a custom renderer for Frame with unique corner radius values [Xamarin.Forms]

$
0
0

I need really some help:
I have been searching about how can I create a custom renderer for a frame control that allows me to give every vertex a different radius but in every question posted in the forum people do not get into a "clear solution", I know how to create custom renderers in controls (only the basics of it) but when i create the custom renderer for frame i just didnt know how beacuse I tryed with android and the control is not being referenced correctly, I please need a solution for this, any help??


Could someone tell me where to put the database and images on a xamarin forms mac project?

$
0
0

I just added a Mac project to my Xamarin forms app.

Does anyone know where to put the images for a xamarin forms mac project?

Also, could someone please show me the correct code for a sqlite database path in a xamarin forms mac project.

Thanks a lot. They keep adding platforms, but not much documentation! (:

Java.Lang.NullPointerException

$
0
0

Hi
On the first page I have the following controls
Xam.Plugin.TabView

TabItem 5

sometimes TabItem 1 to 2 or 3 4 5
What can be the problem

Java.Lang.NullPointerException: 'Attempt to invoke virtual method 'void android.graphics.Rect.set(android.graphics.Rect)' on a null object reference'

Can it be used without tools Xam.Plugin.TabView ، tabpage Created ??

I want to open tabpage in the middle of the page ContentPage

how can include TabbedPage to ContentPage?

PopModalAsync inside Task causes TargetInvocationException

$
0
0

Hi,

I am doing:

await Navigation.PopModalAsync();

and I am running ot from Task but the app crashes with the following error:

System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'

Here is how I am running it:

await Task.Run(SignupUser);

and the SignupUser is like this:

async void SignupUser()
{
        ........................
        ........................
        ........................
        ........................
        ........................

        Device.BeginInvokeOnMainThread(async () =>
        {
            await DisplayAlert("Congratulations", "You have successfully signed up.\n\nPlease check your SMS.", "Continue");
            BusyIndicatorSignup.IsVisible = false;
        });

        await Navigation.PopModalAsync();
}

Kindly help..

Thanks,
Jassim

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 ?

Images from url not showing on android

$
0
0

Hey,

I am trying to show some images from my wordpress site in my app. Its working great on iOS but not working on android.
Images I am getting from one wordpress site and I cannot figure it out why its not working on android.

Code I am using to get and show images is from xamarin.com site:

var webImage = new Image { Source = ImageSource.FromUri(new Uri("https ://xamarin.com/content/images/pages/forms/example-appDOTpng")) };

If I use this link then picture shows on both platforms but if I use

var webImage = new Image { Source = ImageSource.FromUri(new Uri("https ://www.sportino-ma.com/wp-content/uploads/2015/11/19884496_436596000030267_1630323802236795993_n-e1499849630652-150x150DOTjpg")) };

it would not work. I have searched the web for solutions but without any success.

I hope that someone can help me.. Thanx..

P.S. - I'm trying to set image source with XAML too but with same result. (using binding imgUrl as source). Space in my links are because I cannot post links here

Refresh TabViewControl navigate Page

$
0
0

hi

goto tap پربازدید ترین back to محصولات برجسته not refresh page TabViewControl

items TabViewControl in ContentView

My data changes on the cart page
Returning to the first page, Waghi shows the early stages
How to refresh

ListView's ContextActions - how to force display all MenuItems as buttons with icons, not text

$
0
0

Hello

I have ListView with 4 ContextActions attached. On Android, when I long press ListView's item, I see 3 of my MenuItems displayed with icon and the fourth one is displayed as text under "3 dots more" button.

I checked Xamarin.Forms source code and I think that ContextAction's menu items are rendered as regular Android's MenuItems:
https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.Android/CellAdapter.cs

I also checked Android's documentation which says Android can display up to 6 Menu Items:
https://developer.android.com/guide/topics/ui/menus.html#options-menu

Is it possible to force all 4 Menu Items be displayed with icon? It's a must-have for my app to display all 4 Menu Items as icons, no "more" button.

Many thanks for any help
Best regards


C# Xamarin Forms inApp purchase subscription with InAppBillingPlugin

$
0
0

I am using InAppBillingPlugin and I am going throu the exceptions to try and see how can I manage purchasing of subscritpions. Now, regarding the code, everything works fine. No need any samples or any code help. My problem is here; I can purchase and consume consumable items but I am wondering how will I deal with subscriptions. When trying to purchase an item already owned, Google Play billing will return an error as followed;

BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED 7 Failure to purchase since item is already owned
which will work fine for checking the subscription I guess.

In the library of jamesmontemagno, the hyperlink above, in the error checking section, this error is not covered. Hence I can not get to know when a user will be able to purchase the subscription again. Without having that error checked, user will be charged everythime he clicks on purchase even if he already owns the purchase. Or is Google Play Billing going to block it since the user has already purchased the subscription and it is still active?

If it is the case, the best thing is to check all the available errors and if it is not in the existing list provided by the library, then take it as already owned item? I know my question is very vague and I am sorry if it confusing. It is confusing for me also.

Link to the library: https://jamesmontemagno.github.io/InAppBillingPlugin/HandlingExceptions.html

How do you properly implement a OnBackButtonPressed override with async functions?

$
0
0

We're a little confused as to how to mix Xamarin.Forms page functions like DisplayAlert and the OnBackButtonPressed override since one is async and the other is not.

We tried this, but the DisplayAlert doesn't appear since there is no await in front of it, but if we add it, it doesn't compile because the overridden event expects the return parameter to be bool, not Task<bool>.

protected override bool OnBackButtonPressed (){
    if (this.Detail.GetType().ToString() == "Klaim.HomePage") {
        Task<bool> action = DisplayAlert ("Quitter?", "Voulez-vous quitter l'application?", "Oui", "Non");
        if (action.Result) 
            DisplayAlert("debugvalue", "TRUE", "ok");
    } else {
        ViewModel.NavigateTo (new HomePage(new HomeViewModel()));
    }
}

Getting Mono.AndroidTools.RequiresUninstallException on Android

$
0
0

Today I started getting this deployment error on android:

Severity Code Description Project File Line Suppression State
Error ADB0030: Mono.AndroidTools.RequiresUninstallException: The installed package is incompatible. Please manually uninstall and try again.
at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) in E:\A_work\267\s\External\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:line 339
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass95_0.b__0(Task1 t) in E:\A\_work\267\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 753 at System.Threading.Tasks.ContinuationTaskFromResultTask1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at AndroidDeviceExtensions.d__11.MoveNext() in E:\A_work\267\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 187
--- End of stack trace from previous location where exception was thrown ---
at AndroidDeviceExtensions.d__11.MoveNext() in E:\A_work\267\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 194
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at AndroidDeviceExtensions.d__11.MoveNext() in E:\A_work\267\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 203
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Xamarin.AndroidTools.AndroidDeploySession.d__112.MoveNext() in E:\A_work\267\s\External\androidtools\Xamarin.AndroidTools\Sessions\AndroidDeploySession.cs:line 414
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Xamarin.AndroidTools.AndroidDeploySession.d__106.MoveNext() in E:\A_work\267\s\External\androidtools\Xamarin.AndroidTools\Sessions\AndroidDeploySession.cs:line 217
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Xamarin.AndroidTools.AndroidDeploySession.d__104.MoveNext() in E:\A_work\267\s\External\androidtools\Xamarin.AndroidTools\Sessions\AndroidDeploySession.cs:line 119 0

It only happens in Debug, but in Release i can deploy and run the app just fine.
Why is this happening?

This morning i installed the Android SDK 10.0 and I suspect it started after that, so now I uninstalled it, but I still can't deploy because of the same error.
Other apps from the same PC can be deployed just fine, so I don't get it...

I did check this out
https://docs.microsoft.com/en-us/xamarin/android/errors-and-warnings/adb0030

but I don't even have my app installed on the device...

Thanks

How to save large json data to db

$
0
0

hello guys need some help, actually the thing is right now i am making an http method to our server for getting user data this data is coming in json format and its very large.
right now i am able to save it in db using multiple foreach but its very slow and it is taking too much time for storing so is there any other convenient method for storing large json response directly to db like automapper or anything?
FYI i am using sqlite-net-pcl for storing this data.

How to set the height of a grid to fill the screen and keep the width proportional?

$
0
0

Hi all,
I've created a page in XAML where I have a grid inside a scroll view. The grid contains buttons that represents the map of a site. The objective is to set the height of the grid to fill the available space of the screen and keep the width proportional to the height. The grid is essentially a rectangle so the width of the grid will be inevitably out of the screen, but thanks to the scrollview I will be able to scroll horizontally. If you have an idea how I can achieve this it will be appreciated. Also, if you have another way to achieve this without a grid or a scrollview feel free to share it. Thank you.

Viewing all 77050 articles
Browse latest View live


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