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

Page Popped notification

$
0
0

Is there any way to get a notification that a content page has just been popped from the stack ?
I'm using Prism to navigate the pages.
await navigationService.NavigateAsync("MyNextPage", navParams, useModalNavigation: false);
Without the Prism I would create NavigationPage instance "wrapped" around my content page, and for the navigationPage instance I would register a callback for NavigationPage.Popped event.

How to get a similar notification when using Prism ?

Thanks,
Michal


NavigationPage Icons

$
0
0

I am trying to specify Icons for my bottom toolbar, I have the following code:

On Platform="Android" Value="@drawable/calendar-check"/

I download the icons from material design icons and got a package with the different sizes. I extracted them to respective folders in /Resources. So now I have a bunch of files in these folders, e.g. ic_calendar_check_grey600_18dp.png. How do I then address it in my code above? I have tried several different ways, such as

On Platform="Android" Value="@drawable/ic_calendar_check"/
On Platform="Android" Value="ic_calendar_check_grey600"/

And several other alternatives but I cant find what is the correct way to import the image/icon. Any tips? Currently Im focusing on Android. I am also not sure what "dp" version of the image to choose.

Pass page BindingContext or parameter to a converter

$
0
0

Hi All, I am trying to handle dynamic language changing in my app.

Probably relatively simple but I am trying to pass the pages binding context as a param to a converter to give access the AppResources:

The property I want to get access to in the converter is AppResources in the page model:

public LocalizedResources AppResources
        {
            get;
            private set;
        }

I access resources with a key like this:

public string this[string key]
        {
            get
            {
                return _resourceManager.GetString(key, _currentCultureInfo);
            }
        }

So in my XAML page with a label I do this and it works fine:

Text="{Binding AppResources[LanguageLabel]}"

Im just trying to provide access to the converter with the bindingcontext like this but not working:

<pages:BaseContentPage
    x:Class="MyApp.Pages.ThePage"
    x:Name="Foo"
...>

Text="{Binding HouseKeepingHistoryStatus, Converter={StaticResource HousekeepHistoryStatusToProgressDescriptionConverter}, ConverterParameter={x:Static Foo}}"

not working either:

<Label
                                    FontFamily="{StaticResource RegularFont}"
                                    FontSize="{StaticResource SubHeader}"
                                    Text="{Binding HouseKeepingHistoryStatus, Converter={StaticResource HousekeepHistoryStatusToProgressDescriptionConverter},ConverterParameter={Binding .}}"
                                    TextColor="White"
                                    VerticalOptions="Center" />

I bassically just want to get access to LocalizedResources file i.e. AppResources to my converter so maybe I can do it directly rather then the containing page model.

Alternatively when I try to define a property on the Converter like this:

public LocalizedResources LocalizedResources { get; set; }

and in xaml I do below I but get mismatch error i.e. No property, bindable property, or event found for 'LocalizedResources', or mismatching type between value and property.:

<pages:BaseContentPage.Resources>
        <ResourceDictionary>
            <converter:HousekeepHistoryStatusToProgressDescriptionConverter x:Key="HousekeepHistoryStatusToProgressDescriptionConverter" LocalizedResources="{Binding AppResources}" />
        </ResourceDictionary>
    </pages:BaseContentPage.Resources>

Is there a straight forward way to handle this?

How to keep copy-paste and scroll for editor inside scrollview (Xamarin Forms for Android)?

$
0
0

Hi everyone,

I am struggling with Editor for Android, using Xamarin.Forms v3.1.0.697729. If I test with editor as single item inside a stack layout (without scrollview), it is possible to both do a copy and paste of the text, and scroll. After adding scrollview, the scroll inside editor stops working, but copy-paste still works. To fix that, I implemented a custom renderer for Android with DroidTouchListener, as suggested in topic "Editor inside Scrollview not scrolling" from this forum. Now scrolling is working, and long-press to paste is working, but not long-press to copy text. So it seems that I have to choose between having fully functional copy-paste, or to have only paste but with functional scroll.

Does anyone have a workaround for this issue?

why does ios 'email.compose' cause nullexception when including attachment but Android doesnt

$
0
0

Using the experimental
I have this code which sends a gps (track file) via email
Works fine in Android but falls over in the appdelegate of iOs with null exception - its definitely the attachment -remming it out eliminates the issue
var message = new EmailMessage
{
Subject = "Mygps Track",
Body = "My gpx track which can be viewed in google earth"
} ;
ExperimentalFeatures.Enable("EmailAttachments_Experimental");
if (File.Exists(fnm3))
{
message.Attachments.Add(new EmailAttachment(fnm3));
}
await Email.ComposeAsync(message);
//.........................................
Anyone any ideas why it should behave differently with iOs ?

I am checking that the file exists so its not a null attachment or anything like that
I am stumped - anyone have any ideas ? I know I am using the 'experimental'stuff but does this not work in iOs?

Is anyone there who can give me an example demo on how the SelectionChangeCommand and Parameter work

$
0
0

In my custom controls and button, the premade and my custom Command and CommanParameter properties are perfectly working, because most of the time I just need a single object to be return base on the selected item. Currently, I'm using collectionview with a multiple selection mode, and I just want to know if how the SelectionChangeCommand and SelectionChangeCommandParameter will work properly because this time I need a list of selected items.

Currently, I'm using the code behind SelectionChanged event method of collectionview and I want to switch on the command and command parameter process.

My B class can't subscribe to my A class' event

$
0
0

Hi all,

I have a code like this one:

public class MyViewModel : INotifyPropertyChanged
{
    public IResourceProvider Resources { get; private set; }

    public MyViewModel()
    {
        this.Resources = new ResourceProvider();
        this.Resources.PropertyChanged += this.MyMethod();
    }

    public void MyMethod()
    {
        // Do something
    }
}

public class ResourceProvider : IResourceProvider
{
    public event PropertyChangedEventHandler PropertyChanged;

    // Fired when culture has changed (receiving message from MessagingCenter)
    private void OnCultureChanged(object s, CultureChangedMessage ccm)
    {
        this.Culture = ccm.NewCultureInfo;
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Item"));
    }
}

But when I write this, IntelliSense tells me that "IResourceProvider does not contain a definition for PropertyChanged"... So, where is my mistake ?

Thanks for you help,
Galactose

ReSide Menu in Xamarin Forms

$
0
0

Hey guys, there's any control plugin in Xamarin Forms, to customize the shell control like this?, if don't, what's the best way to achieve this result?


Does anyone know whether you can integrate React Native with Xamarin?

$
0
0
I have a team where half the people know Xamarin and half the people know React Native (Expo CLI). Is there any way to combine the two?

Is showing the payment pages using Webview solves the App-store's In-App Purchase issue?

$
0
0

I got a new message from Appstore for my new app submission:

Guideline 3.1.1 - Business - Payments - In-App Purchase

We noticed that your app or its metadata enables the purchase of content, services, or functionality in the app by means other than the in-app purchase API, which is not appropriate for the App Store.

My app has a payment feature and I have implemented it using stripe.

The payment feature is implemented on sign up, free trial and manage subscription pages. Currently, I have implemented all these features in the app itself. I have website links for these pages and I can show these pages using a webview with the website links. If I do like that, is AppStore approve my app? I have also removed the Stripe.net NuGet package.

Change NavigationPage Color for a specific page

$
0
0

Hi,

I am using this code:

(App.Current.MainPage as NavigationPage).BarBackgroundColor = Color.FromHex("#000000");
(App.Current.MainPage as NavigationPage).BarTextColor = Color.FromHex("#ffffff");

to change the NavigationPage color of the MainPage

But how can I add to a specific page, like this for a Signin page for example:

public Signin()
{
    InitializeComponent();

    (App.Current.THIS_PAGE as NavigationPage).BarBackgroundColor = Color.FromHex("#000000");
    (App.Current.THIS_PAGE as NavigationPage).BarTextColor = Color.FromHex("#ffffff");
}

Thanks,
Jassim

How to save audio file after recording voice in Xamarin.Forms

$
0
0

I am wondering how to save an audio file in Xamarin forms. I can get the location where to save to AppDataDirectory using Xamarin.Essentials:

var mainDir = FileSystem.AppDataDirectory;

But I am not sure how to save it in code, right after recording it using the NateRickard AudioRecorder Plugin:

var recordTask = await recorder.StartRecording();
var audioFile = await recordTastk;

Its same as saving/creating any binary file in C#? Say its same as saving an image file? And additionally do I need to use Dependency Injection to save it using platform specific code, or I can manage to only do it from the PCL code?

XAMARIN FROMS SHELL SLID MENU

$
0
0

Hello i just want to ask how can i make Shell.FlyoutHeaderTemplate ( side menu ) start from right to left

How to Get full File Path of Image and Upload it to server

Could not resolve type with token 01000012

$
0
0

I've been developing my app now for at least 5 months. I've been wanting to try the xamarin previewer so i updates visual studio xamarin forms and then i updated my nuget xamarin forms for my portable, ios and android.

now when i try to debug the application on the device i get

System.TypeLoadException: Could not resolve type with token 01000012

on this line

global::Xamarin.Forms.Forms.Init(this, bundle);

which i find very odd

origionally my xamarin forms nuget version was 2.3.3.168

so i thought id update to the stable version which was the same version number 2.3.3.168 but it had "stable" beside it

i've downgraded again but still get the same error.

any thoughts

thanks


Getting a download link of uploaded file (e.g image) Immediately after a Successful upload.

$
0
0

I am using a Firebase Storage Dotnet Library by Step-Up-Labs to Upload Images from Xamarin.Forms application to Firebase Storage. The Images succefully uploads without any error. But the Problem is that i have to use TWO Tasks. First Task Uploads Image to Firebase & Second one is to Get the Uploaded Image Download Link with Token. For Second Task i'm using a ENTRY to get Download Link. I want to Merge these Both tasks. In simple, I pick an image from gallery, then upload it to Firebase Storage . As soon as image Upload completes the Download Link Immediately Fetch & Shows in ENTRY .
Below Is My Code So You Can easily Understand What i'm saying....

using Firebase.Storage;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;

namespace WhatsLinks.Databases
{
public class FirebaseStorageHelper
{
FirebaseStorage firebaseStorage = new FirebaseStorage("");

    TASK 1
    public async Task<string> UploadImage(Stream fileStream, string fileName)
    {
        var imageUrl = await firebaseStorage
            .Child("UserImages")
            .Child(fileName)
            .PutAsync(fileStream);
        return imageUrl;
    }

    TASK 2
    public async Task<string> GetImageFile(string fileName)
    {
        return await firebaseStorage
            .Child("UserImages")
            .Child(fileName)
            .GetDownloadUrlAsync();
    }
}

}

Navigation.PushAsync getting called multiple times on a single button press

$
0
0

Greetings everyone,
I'm having a weird issue with my calls to PushAsync pushing multiple instances onto the navigation stack in my Master Detail view system..

What's happening is that once I click on the button, it fires off the following code

await Navigation.PushAsync(new WeaponInventoryPage()).ConfigureAwait(true);

This loads a page, as expected, but for some reason the code gets repeated several times?
When stepping through the debugger I get the following code process

PageA
Button.Click(navigate to PageB)
PageB
Call class constructor.
InitializeComponent();
viewModel = new WeaponInventoryViewModel();
BindingContext = viewModel;
PageA
Button.Click(navigate to PageB)

This process repeats two or three times.
I've even tried encapsulating the Navigation.PushAsync call in a semaphore, but still get the same result...

Can anyone help?

Tabbed Page and memory usage

$
0
0

How is memory handled with tabbed pages?

Are all the child elements created fully and held in memory, or are they only instantiated when brought into view?

I have a project with some data that needs to be displayed in a tabbed page format, however there could be up to 50 tabs, each with quite a lot of data to display. There are concerns that there will be high memory usage issues if the tabs are all created at once and sit there waiting to be seen.

I'd be grateful for any info if anyone knows. Thanks!

Adding numbers to pins on Xamarin.Forms.Maps

$
0
0

I have a maps page and several pins (different amount for each user) and I would like to add a number on top of each pin/marker, so the user can see which pin comes first. I could make my own images and assign the images when I loop through each pin but that seems really tedious as there might be 100+ pins so I would need 100+ of the same pin icons but with different numbers labelled on them.

Desig CarouselView

$
0
0

hi

How do I design this form
Show 2 column in page

Viewing all 77050 articles
Browse latest View live


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