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

How to change each items background color in a ListView based on incomplete/complete data

$
0
0

Is it possible to change the background color of the view cell if the information in the view cell is not complete.
In the image connected the first item in the ListView is filled in completely and I want to display the background color white. The second item in the list has incomplete information and I want to display that to the user with a red or yellow background so they know that item has unfilled data.

This app is a data collection app for cruising timber lands.


Xamarin.Forms ZXing scanner double-scanning barcode

$
0
0

Hi,

I'm using ZXing to scan barcodes. In some cases however, it takes some time to process the found value of the barcode. To let the user know that the scanner has picked up the barcode, I added a ACR.UserDialog to show that the app is working on it.

The scanner itself however remains active, causing it to scan over and over again if it sees a barcode. This causes my app to crash.
I tried to solve it with IsAnalyzing = false and IsEnabled = false, but that didn't do the trick:

The barcode is processed in open_page().

Does someone know how to disable/turn off ZXing while processing the barcode?

Regards, Ganesh

How to insert all data using InsertAllAsync

$
0
0

Hello.. anyone know how to insert all data using InsertAllAsync.. i want to insert all data before i delete data in sqlite.

Shared Auth across multiple WebViews

$
0
0

Hi Everyone,

I have a MasterDetailPage setup where I can load a detail page which presents a webview - in that webview I sign in to a secure website. That works fine.

I then change the menu bar (Master) in my MasterDetailPage and allow access to lists of pages, including a RSS list which onwardly loads (via Naviation.PushAsync(new page1())) web views that are behind the same authentication that I passed a few seconds ago.

This time however I am pushed back to the sign in page?? Any know how I can force or keep the authentication session live between web views?

I'm sure this has been tackled before, fixed before or solutions created before - it must be a common issue but I just can't seem to find a solution.

Any and all help is greatly appreciated.

Thank you

App center distribute - your experience with in-app updates

$
0
0

I have android app in which I implemented in-app updates through App Center. At the beginning, around a year ago, when I first implemented it, it seemed to work well. Few months ago, however, for no apparent reason it stopped updating the app. The message that there's new release pops up but when I tap update either nothing happens, or downloading progress bar shows up but it's unable to start. It'll loop all the time indicating that it's trying to set a connection or something, but it won't get any further no matter how long you'd leave it.. Tested on few phones on Android 7.0 and few on Android 9.0. App center updated to latest version, application is enabled to install unkown apps. I even turned Play Protect off, still nothing.

What are your experiences with App Center distribute modul? Did anyone manage to get it to work reliably?

Essentials Web Authenticator does not provide PKCE support

$
0
0

Since it is the recommended flow to support mobile clients using OpenID Connect it seems surprising that Web Authenticator does not appear to support PKCE.
I have seen David Britch's post where he combines Web Authenticator with IdentityModel.OidcClient however that has a bit of a problem on iOS when the Authority supports shared cookies and thus pops the iOS Sign In permission. Declining that causes an NSErrorException to be thrown in WebAuthenticator. Also, this OidcClient tends to be quite slow, presumably because it's parsing the discovery document.
Does anyone know if it is planned to support more complex flows using WebAuthenticator?

xamarin build error

$
0
0

I have open 2017 project from 2019. Now i am getting this error. my Xamarin.Android.Support.Core.Utils version is 27.0.2 and Xamarin.Android.Support.v4 is 23.4.0.1

The type 'FileProvider' exists in both 'Xamarin.Android.Support.Core.Utils, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

Side drawer menu for Tablet view

$
0
0

Hi,

I developing mobile application using Xamarin.Form. For dashboard page I used MasterDetailPage, here I assigned MenuPage to Master & Contect page to Detail , below is the code.

class MasterPage : MasterDetailPage
    {
        public MasterPage()
        {
            Master = new Menu();

            Detail = new NavigationPage(new DashBoard()) {
                BarBackgroundColor = Color.FromHex("#1ab394"),
                BarTextColor = Color.White
            };
        }
    }

Please check below are the output,
Android Output

Windows Output tablet

You can see the difference, here in android portrait view here we can hide/show side drawer menu by clicking on 3Bar button, but in windows/all tablet view the menu part always visible instead of **3Bar ** Button.

How can we make customization for tablet view where menu page visible unless we click on 3Bar button.

Please let me know.

Thanks in advance!


[Shell] Pass parameter to local shellcontent's constructor from XAML

$
0
0

Is this even possible?

Thank you!

Toolbar goes up when keyboard opens xamarin forms

Grouping CollectionView With Horizontal Orientation

FirebaseApp is not initialized on real devices

$
0
0

Hello! I'm trying to add push notifications in Xamarin.Forms.
On Genymotion it's work fine but on real devices i have an error:
Default FirebaseApp is not initialized.Make shure to call FirebaseApp.initializeApp(Context)

google-services.json is present in Android project with GoogleServicesJson BuildAction

My MainActivity:

     public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
        {
            internal static MainActivity Instance { get; private set; }
            internal static FirebaseInstanceId FirebaseInstance { get; private set; }

            public static int CurrentUserId { get; set; }
            protected override async void OnCreate(Bundle bundle)
            {
                base.OnCreate(bundle);           

                TabLayoutResource = Resource.Layout.Tabbar;
                ToolbarResource = Resource.Layout.Toolbar;

                VideoViewRenderer.Init();
                global::Xamarin.Forms.Forms.Init(this, bundle);
                string dbPath = FileAccessHelper.GetLocalFilePath("LocalDataBase.db");

                LoadApplication(new App());

                Xamarin.Forms.Application.Current.On<Xamarin.Forms.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);
                UserDialogs.Init(this);
                CachedImageRenderer.Init();           

            //on real devices it return  null
                var app = Firebase.FirebaseApp.InitializeApp(this.ApplicationContext);

                Instance = this;
            }

Xamarin Forms Slider With Custom Thumb

$
0
0

I am trying to make a custom SliderRenderer for Xamarin.Forms that can allow me to change the thumb to be in image instead of just a circle.

On native Android I found you can do something like this:

Drawable myThumb = getResources().getDrawable(R.drawable.slider_button);
myThumb.setBounds(new Rect(0, 0, myThumb.getIntrinsicWidth(),myThumb.getIntrinsicHeight()));
skbr.setThumb(myThumb);

Link to source: http://stackoverflow.com/questions/3882992/how-can-i-change-the-android-seekbar-thumb-drawable-after-oncreate-method

I don't know how to get an image or resource properly with Xamarin Android though. Anyone know how to handle this?

How to cancel navigation using OnNavigation override method? (Application Using Shell)

$
0
0

Hi to all,
I want to cancel a navigation due to validation reasons.
I find a method Cancel() from ShellNavigatingEventArgs parameter object in OnNavigating method but it doesn't work.
With the help of the debug mode i can check that even the Canceled property is change from false to true after using the Cancel() method. The Navigation continues anyway.

What am i missing here? Should i use other way to cancel the navigation ?

Regards.

How to handle NotificationCompat.Builder setTimeoutAfter

$
0
0

Is there a way to handle (maybe a method override) when a push notification has timed out after setting the setTimeoutAfter? I'm wanting to execute an API after the timeout period has passed.

Here is what my SendLocalNotification method looks like in my FirebaseService class. This is where I'm setting my notification timeout:

void SendLocalNotification(string body)
        {
            //Unique request code to avoid PendingIntent collision.
            var requestCode = new Random().Next();

            // accept intent
            var acceptIntent = new Intent(this, typeof(MainActivity));
            acceptIntent.SetAction("ACCEPT_ACTION");
            var pendingIntentAccept = PendingIntent.GetActivity(this, requestCode, acceptIntent, PendingIntentFlags.OneShot);

            // decline intent
            var declineIntent = new Intent(this, typeof(MainActivity));
            declineIntent.SetAction("DECLINE_ACTION");
            var pendingIntentDecline = PendingIntent.GetActivity(this, requestCode, declineIntent, PendingIntentFlags.OneShot);

            var intent = new Intent(this, typeof(MainActivity));
            intent.AddFlags(ActivityFlags.SingleTop);

            var notificationBuilder = new NotificationCompat.Builder(this)
                .AddAction(0, "Accept", pendingIntentAccept)
                .AddAction(0, "Decline", pendingIntentDecline)

                .SetContentTitle("Content Title")
                .SetSmallIcon(Resource.Drawable.laundry_basket_icon_15875)
                .SetContentText("content text")
                .SetContentInfo("content info") // i think content info and sub-text overwrite each other
                .SetSubText("sub text")
                .SetTimeoutAfter(60000)
                .SetAutoCancel(true)
                .SetShowWhen(true)
                .SetContentIntent(pendingIntentAccept)
                .SetContentIntent(pendingIntentDecline);

            if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
            {
                notificationBuilder.SetChannelId(AppConstants.NotificationChannelName);
            }

            var notificationManager = NotificationManager.FromContext(this);
            notificationManager.Notify(0, notificationBuilder.Build());
        }

Scrolling Issue

$
0
0

I have 2 rows. When scrolling I want both of them to move down at the same time, but what happens is that the top row stays static whiles the bottom one (which is a CollectionView, if that helps) scrolls down. The top row only scrolls down after getting to about the middle section of the list. I would like to resolve this i.e. I would like everything to scroll down at the same time.

what I'm experiencing

XAML Code

<ScrollView Grid.Row="1">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="2"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                    <!--My Doctors-->
                    <Grid Grid.Row="0"
                          ColumnSpacing="0"
                          RowSpacing="0">
                        <CollectionView ItemsSource="{Binding MyDoctors}"
                                        HeightRequest="90">

                            <CollectionView.ItemsLayout>
                                <ListItemsLayout Orientation="Horizontal"
                                                 ItemSpacing="20"/>
                            </CollectionView.ItemsLayout>

                        <CollectionView.ItemTemplate>
                                <DataTemplate>

                                    <!--My Doctors Image Container-->
                                    <Grid>
                                        <pancake:PancakeView BackgroundColor="Gray"
                                                             CornerRadius="100"
                                                             WidthRequest="65"
                                                             HeightRequest="65"
                                                             HorizontalOptions="Start"
                                                             VerticalOptions="Center"
                                                             Margin="10,0,0,0">

                                            <!--My Doctors Image-->
                                            <Image HorizontalOptions="Center"
                                                   VerticalOptions="Center"/>
                                        </pancake:PancakeView>

                                        <!--Online Status Indicator-->
                                    <pancake:PancakeView BackgroundColor="Red"
                                                         BorderColor="White"
                                                         BorderThickness="3"
                                                         CornerRadius="100"
                                                         HeightRequest="15"
                                                         WidthRequest="15"
                                                         HorizontalOptions="Center"
                                                         VerticalOptions="End"
                                                         Margin="60,0,0,15"/>
                                </Grid>
                                </DataTemplate>
                            </CollectionView.ItemTemplate>
                        </CollectionView>
                    </Grid>

                    <!--A simple seperator-->
                    <pancake:PancakeView Grid.Row="1"
                                         BackgroundColor="#cccccc"
                                         Margin="15,0,15,0"
                                         HasShadow="False"/>

                    <!--Recent Doctors List-->
                    <CollectionView Grid.Row="2"
                                    ItemsSource="{Binding RecentDoctors}">

                            <CollectionView.ItemTemplate>
                                <DataTemplate>
                                    <Grid ColumnSpacing="0"
                                      RowSpacing="0"
                                      Padding="0,10,0,10">

                                        <!--Recent Doctors Item Template-->
                                        <pancake:PancakeView BackgroundColor="#F2F2F2"
                                                         HasShadow="True"
                                                         Elevation="5"
                                                         CornerRadius="10"
                                                         Margin="7,0"
                                                         Padding="20,5,0,5">
                                            <Grid>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="80"/>
                                                    <ColumnDefinition Width="*"/>
                                                </Grid.ColumnDefinitions>

                                                <!--Doctors Image-->
                                                <Frame Grid.Column="0" 
                                                   BackgroundColor="#CCCCCC"
                                                   IsClippedToBounds="True"
                                                   Padding="0"
                                                   HasShadow="False"
                                                   CornerRadius="100"
                                                   HeightRequest="80">

                                                    <Image HorizontalOptions="Center"
                                                       VerticalOptions="Center"/>
                                                </Frame>

                                                <!--Doctors Info-->
                                                <StackLayout Grid.Column="1"
                                                         VerticalOptions="Center"
                                                         Spacing="0">

                                                    <!--Doctors Name Label-->
                                                    <Label Text="{Binding DoctorsName}"
                                                       TextColor="Black"
                                                       FontAttributes="Bold"
                                                       FontSize="17"/>

                                                    <!--Specialization Label-->
                                                    <Label Text="{Binding Specialization}"
                                                       TextColor="Black"
                                                       FontAttributes="Bold"
                                                       FontSize="17"/>

                                                    <!--Location Label-->
                                                    <Label Text="{Binding Location}"
                                                       TextColor="#999999"
                                                       FontSize="12"/>
                                                </StackLayout>
                                            </Grid>
                                        </pancake:PancakeView>
                                    </Grid>
                                </DataTemplate>
                            </CollectionView.ItemTemplate>
                        </CollectionView>
            </Grid>
        </ScrollView>

CollectionView Error

$
0
0

hi
CollectionView Bored of this error

I'm displaying a simple list, but this error occurs while scrolling

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


The error I mentioned above occurs on the pages

main
list

Using SkiaSharp, how to save a SKBitmap ?

$
0
0

After editing a SKBitmap in Xamarin.Forms i wanna save it in local storage.

Any idea?

Change Flow Direction of a Content Page?

$
0
0

Hello,

how can I change the flow direction of a Xamarin Forms Content Page from Left to Right to Right to Left? something like Windows Phone Flow Direction property?

Completed not firing in Editor?

$
0
0

I've got a numeric Editor and if I enter a number then touch anywhere else, Completed fires like you'd expect. But in android, off to the right there's a 'Done' button. If you push that the keyboard goes away but neither Completed or Unfocused get triggered. You have to touch the screen somewhere else no matter what. In IOS there's what I can only describe as a 'keyboard down' button in the bottom right. If you press that the keyboard goes away and Completed triggers like it should. My concern here is that in android people are going to be entering numbers and hitting done. But nothing is going to happen because I'm not being notified. This a Xamarin bug?

Viewing all 81910 articles
Browse latest View live


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