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

How to scrolling the Webview

$
0
0

Hi all,

We have an image gallery kind of view which shows only a single image or PDF file per a given time (fitted to screen).
User can navigate back and forward to see other images/PDFs with horizontal panguesture.
XAML is like below.


We have a custom content view which will represent an image(to show image) or a WebView(to show PDF) based on the file type to be displayed.
MainContainer is populated with above custom content views based on data source attached with the Gallery.
TouchContainer which in on top of MainContainer will handle all Pan, Pinch and Tap gestures for the Gallery.
Based on current gesture on TouchContainer behaviors of active custom content view (image or PDF) will be decided.

Issue comes with multiple page PDFs. They can be scrolled properly when loaded separately with custom WebView. But scrolling not functions in the Gallery as TouchContainer is on top of the WebView.

How to resolve this? How can I pass scrolling behavior to the PDF WebView as done with other gestures?

Thanks
Kaushalya


Prism: Back button on Android closes app when popup is open

$
0
0

Hello everyone,

I was working with popups in Prism. With the following code:

_navigationService.NavigateAsync(nameof(TestPopup));

The popup is added to the navigation stack. Therefore, I expect it go to the previous page when pressing the Android hardware back button. Too bad, it doesn't, it just closes the app (because there is nothing more in the navigation stack?)

Here is a test project where I reproduced it in:
https://github.com/GyllionElderen/PrismPopupTest

Does anyone know what to do to make the app go back to the root page instead of closing the app?

UWP - error APPX1101: Payload contains two or more files

$
0
0

I've been banging my head against the wall on this one - it happens on a freshly cloned repo

Its a Forms PCL project with UWP. I am using a ACR.Settings which requires me to install the nuget on the UWP project and the Forms project. I have no idea the cause. Here is the full error, an ideas?

E:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(1748,5): error APPX1101: Payload contains two or more files with the same destination path 'Acr.Settings.pdb'. Source files: [E:\wp\SmartFill\SMC-1-setup-uwp-jenkins-build\SmartCart.UWP\SmartCart.UWP.csproj] E:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(1748,5): error APPX1101: C:\Users\jenkins\.nuget\packages\acr.settings\7.0.2\lib\uap10.0\Acr.Settings.pdb [E:\wp\SmartFill\SMC-1-setup-uwp-jenkins-build\SmartCart.UWP\SmartCart.UWP.csproj] E:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(1748,5): error APPX1101: E:\wp\SmartFill\SMC-1-setup-uwp-jenkins-build\SmartCart.Forms\bin\Debug\Acr.Settings.pdb [E:\wp\SmartFill\SMC-1-setup-uwp-jenkins-build\SmartCart.UWP\SmartCart.UWP.csproj]

Activate Tab using Prism

$
0
0

I am using Prism with my Xamarin Forms application. I have a home page with two tabs- A and B. Tab A has a button which when pressed should activate Tab B. How can I do that with Prism? Both the tabs have separate view models and each view model implements IActiveAware. I am currently using Event Aggregator but that seems really unnecessary to me for just activate tab?

Thanks

Apurva

Xamarin Media Plugin doesn't works on Android

$
0
0

Hi,
I've installed the plugin "Xam.Plugin.Media".
The plugin works fine on IOS but on Andorid the app crash as soon it starts.

I have followed the readme.txt that come after the installation of the plugin, so my files are:

MainActivity.cs:

using System;

using Android.App;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Plugin.Permissions;
using Plugin.Permissions.Abstractions;
using FFImageLoading.Forms.Droid;

namespace SgatMobileV2.Droid {
    [Activity(Label = "SgatMobileV2", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity {
        protected override void OnCreate(Bundle bundle) {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

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

            CachedImageRenderer.Init(enableFastRenderer: true); // Inizializza il plugin FFImageLoading

            LoadApplication(new App());
        }

        public override void OnRequestPermissionsResult(int requestCode, string[] permissions, global::Android.Content.PM.Permission[] grantResults) {
            PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
        }
    }
}

Resources/xml/file_paths.xml:

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
  <external-files-path name="my_images" path="Pictures" />
  <external-files-path name="my_movies" path="Movies" />
</paths>

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="it.volos.SgatMobile" android:installLocation="auto">
  <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="26" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.CAMERA" />
  <application android:label="SgatMobileV2.Android" android:icon="@drawable/icon">
    <provider android:name="android.support.v4.content.FileProvider" android:authorities="it.volos.SgatMobile.fileprovider" android:exported="false" android:grantUriPermissions="true">
      <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
    </provider>
  </application>
</manifest>

But after the app starts, this error is triggered:

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

Can anyone help me please?

Thank you!

How to serialize an Image object?

$
0
0

Is this even possible? If it is not possible, is there a way to convert Image object to Byte array?

Preserving layout...Is there a means in Xamarin Forms to force the preservation of the layout?

$
0
0

I have a label that shows a title above an entry box, the request is to have the label appear only when the entry box contains data. When the entry box does not contain data, show the placeholder text and hide the label. That was the easy part, the difficult part is preventing the page layout from changing when the label is hidden or the text property is set to an empty string. So essentially what I am being asked to do is to preserve the layout regardless of the content of the label or the visibility of the label...Is there a means in Xamarin Forms to force the preservation of the layout? What it is currently happening; when the entry is blanked out the label appears (the page/controls shift down to allow the label to appear), when text is entered into the entry control the label blanks out and the page/controls shift up)...the shifting is the problem. Please see the code snippet below:

                <StackLayout 
                    x:Name="stkAccountID"
                    Grid.Row="0"
                    VerticalOptions="Start">
                    <Label Text="" Style="{StaticResource BaseSmallLabelSyle}" IsVisible="True">
                        <Label.Triggers>
                            <DataTrigger TargetType="Label" Binding="{Binding Source={x:Reference entAccountID}, Path=Text.Length}" Value="0">
                                <!--<Setter Property="IsVisible" Value="false" />-->
                                <Setter Property="Text" Value="{ artina:Translate LabelAccountID }" />
                            </DataTrigger>
                        </Label.Triggers>
                    </Label>
                    <Entry x:Name="entAccountID" Placeholder="{ artina:Translate LabelAccountID }" Style="{StaticResource ArtinaLoginEntryStyle}" 
                           Text="{Binding AccountID}" Keyboard="Numeric">
                        <Entry.Behaviors>
                            <local:AccountIDValidationBehavior x:Name="entAccountIDValidator" MaxLength="5" />
                        </Entry.Behaviors>
                    </Entry>
                    <Label
                        Text="{ artina:Translate ErrorPleaseEnterValidAccountID }"
                        IsVisible="false"
                        Style="{StaticResource ValidationEntryErrorStyle}">

                        <Label.Triggers>
                            <DataTrigger TargetType="Label" Binding="{Binding Source={x:Reference entAccountIDValidator}, Path=IsValid}" Value="false">
                                <Setter Property="IsVisible" Value="true" />
                            </DataTrigger>
                        </Label.Triggers>
                    </Label>
                </StackLayout>

How to get entries ID?

$
0
0

Hi I have some entries and for each entry I have to set a min and max value, and I intend to use a switch case in the unfocused event but I don't know how to get entries IDs. Here is my code

       private void FocusChange(object sender, FocusEventArgs e)
        {
            ExtendedEntry entry = (ExtendedEntry)sender;
            if (entry.IsFocused)
            {
                entry.BackgroundColor = Color.Yellow;
                entry.Tag = entry.Text;
            }
            else
            {
                if (entry.Text.Trim().Length == 0)
                {
                    entry.Text = entry.Tag;                    
                }
                entry.BackgroundColor = Color.FromHex("#eee");               
                switch(entry.Id)
                {

                }
}

My goal is that when user enters a number that is out of range, i.e larger than the max value, and then clicks Done button, the entry value will be set back to the oldValue


Is LinkedIn Xamarin Free?

$
0
0

I will use facebook login in xamarin forms project.

so find out Houssem Dellai's nuget.

in the Houssem Dellai's Video in Youtube, he used linkedin api.

If i use linkedin, have i payment the charge? orlinkedin is free?

How to update application when values are being changed in AppConstant.cs file?

$
0
0

Hello Friends,

I have created AppConstant.cs file to use different constant values. Now consider an example of Font Size. A variable DefaultFontSize is declared and value of it is being set from database table Setting. Using this DefaultFontSize other font size are defined.

    public static double NormalFontSize = CSettingsLocal.GetIntValue("DefaultFontSize", "DefaultFontSize", 10, false);
    public static double LargeFontSize = NormalFontSize + 14;
    and so on...

Now I go to Setting Form and change the DefaultFontSize. I want the Font Size in all application screen gets changed however right now it is showing changes only after I close the application and open it again.

How can I make the changes work after saving the setting instead of close and open the application again?

How to open google plus sign in in Xamarin Forms

$
0
0

Hi everyone. I have to open a google plus verification page on button click and after sign in in google plus we should be able to get the Email Id of the user who logged in.Please help me with this your help will be appreciated. :)

Hockyapp distribution ?

$
0
0

How to distribution release version for multiple users? and every user need HockyApp Account or Not ?

Thanks

How can I load animation, after the page refreshed?

$
0
0

Hi, I'm new with Xamarin, and I create a simple game, when you accept the quest and the answer was right, I just want to create an animation (OK image translateTo) when the activatorindicator IsBusy field turns to false, so after that the page was loaded.

Android ILocationListener in Xamarin.Forms (not an Android project)

$
0
0

I want to use ILocationListener but in a Forms project. Simple as that.

Just like in Android you add ILocationListener to an Activity and use the OnLocationChanged method to get the device's position (latitude and longitude).

Thank you in advance.

before must be in the pushed stack of the current context on redirect

$
0
0

In my xamarin Form portable class, there are 5 content pages. First one is login page after login user redirects to page A. After PageA user redirect to PageB and PageC and lastly reached pageE. After reached the pageE i want to redirect user to PageC.
At sucessfully login user redirect to PageA using

        Navigation.InsertPageBefore(new PageA(), this);
        await Navigation.PopAsync();

From PageA to PageB
Navigation.InsertPageBefore(new PageB(), this);
await Navigation.PopAsync();

The same process i am using for PageB to PageE .After reached on PageE i want to redirect user to PageC
For this i am using

      Navigation.InsertPageBefore(new PageC(), this);
      await Navigation.PopAsync();

At the Navigation.InsertPageBefore(new PageC(), this); i'm getting exception before must be in the pushed stack of the current context.

My App.xaml.cs class

           public App()
            {
                try
                {

                    InitializeComponent();               
                    MainPage = new NavigationPage(new LoginPage());                
                }
                catch (Exception ex)
                {

                }
            }

Can you please let me know how to resolve this issue.


Just create a BindableProperty, not use yet

$
0
0

Hi,

I declare a bindable property as so

    public static readonly BindableProperty ValueProperty = BindableProperty.Create(nameof(Value), typeof(decimal), typeof(WaterTestInputView), propertyChanged: OnValueChanged);

    public decimal Value
    {
        get => (decimal)GetValue(ValueProperty);
        set => SetValue(ValueProperty, value);
    }

JUST DECLARE AND DON'T USE YET.

Then I got run time exception on android as
System.TypeInitializationException: The type initializer for 'MY CLASS' threw an exception.

Do you know why?

How to hide or remove particular tableSection(Xamarin.forms) which created by xaml?

$
0
0

I'm making app with using Xamarin.form.

I created tableview that has three sections from xaml. And I want to hide or remove last section (entire section, with sectionTitle).

But unfortunately, Xamarin xaml doesn't support conditional processing. (only works if element has isVisible property but tableSection does not have it)

Is there any option I can do?

Thanks.

How to debug xamarin forms app on iOS?

$
0
0

I purchased a cloud mac from macincloud.com for debug my xamarin forms iOS project.And I am using windows with Visual studio 2015 professional

1)so do I need to install Visual studio on mac machine?
2)can I install xamarin studio on mac? and does it works with visual studio 2015 on windows machine?
3)can I debug application on i phone on my windows machine or not with usb cable?
4)should I create any developer account for deploy app on iOS?

Setting HeightRequest of ListView as sum of all the Item's RowHeight

$
0
0

Hello,
I have ListView which has been put inside the ScrollViewer. ListView renders with fixed height irrespective of number of items in ListView and as ListView is inside ScrollViewer, ListView's Scrollbar doesn't function (it doesn't even show up). So what I want is ListView height should be such that it show up all the items without any scrollbar. My searching on this issue suggests that issue is known issue without any proper fix. I tried various workaround as suggested on different posts however it creates one or another problem at runtime.

Only way to fix this problem seems to be adding up the Row heights of items dynamically upon loading of the list and set the sum of all the item's Rowheight to HeightRequest of ListView. So can anyone suggest proper way of calculating the RowHeight of each item. Pls note that I have uneven rows i.e. each item's rowheight can be different.

Looking forward to pointer/code snippets.

Thanks

Has anyone successfully created a parallax scrolling effect with ListView?

$
0
0

This seems like something XF should be able to do given that many apps use this feature. Anyone successfully created a parallax scrolling effect using a ListView as the body and then a header view at the top?

Viewing all 58056 articles
Browse latest View live


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