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

Is there a way to retrieve random documents with DocumentDB?

$
0
0

I am using DocDB inside a XF project.


Cross Platform App(Xamarin.Forms) Applet is missing

$
0
0

I have installed visual studio 2017 enterprise edition windows 10. I also installed below tools.
.NET Development Development
Universal WIndows Platform development
ASP.net and web development
Mobile development with JavaScript

Since Cross Plateform App(Xamarin.Forms) is not avaliable, I am not able to follow xam-120 class and unable to create Cross Platform App(Xamarin.Forms). I am new to Xamarin, it's very hard to follow calss when you don't have same tools available as instructed in te class.

In my C# Cross Platemform, I have only two templates available as below.
1) Mobile App(Xamarin.Forms)
2) UI Test App(Xamarin.UITest | Cross-Platform)

Thank you.

Android Keyboard Input Going In Wrong EntryCell.

$
0
0

I have a simple username password content page. However on a small number of devices, when the text is entered into the Password field, it shows up in the user name EntryCell. The password field is a custom renderer to mask the input. This works on the majority of the devices and I cannot reproduce it. It only happens on Android, iOS/UWP works fine. A user sent a video in showing the problem. Any ideas why its happening?

Video: image

ContentPage:
<ContentPage.Content> <TableView Intent="Settings"> <TableRoot> <TableSection Title=""> <EntryCell x:Name="labelUsername" Placeholder="" Label="Email" Text="{Binding UserName}" Keyboard="Email" /> <local:PasswordEntry x:Name="labelPassword" Label="Password" Text="{Binding Password}"/> <SwitchCell x:Name="labelOffline" Text="Offline/Non-Premium Account" On="{Binding IsOffline}" /> </TableSection> </TableRoot> </TableView> </ContentPage.Content> </ContentPage>

What are best practice approaches to multi-table database applications requiring on/off-line sync?

$
0
0

Relatively new to mobile app development and seeking current best practice approach for a Xamarin.Forms (droid, iOS and UWP) app using Azure SQL(on-line SQL) and SQLite(off-line localdb) related to multi-table synchronization and database operations.

Can anyone provide an opinion NuGet packages on using sqlite-net-pcl (Frank A. Krueger) for normalized localdb multi-table CRUD, database operations joins, contains, wheres etc. and combining with Microsoft.Azure.Mobile.Client/Microsoft.Azure.Mobile.Client.SQLiteStore (Microsoft) for the synchronization of local and cloud database tables as a best practice approach? Any suggestions for how to manage the multi-table database Xamarin.Forms environment?

Xamarin forms create private nuget package (private library)

$
0
0

Anyone could direct me to how to create private nuget package for Xamarin Forms.?

I have been looking into creating one but no luck.

I have just found out that James Montemagno has Xamarin Plugin Template ready for us. on VS2017 extension. From here I'm not sure how to create nuspec and create private nuget package so I can reuse it on other apps.

Splash screen re-visited: How to scale Android splash screen image?

$
0
0

In the styles.xml file of my Android project, I have the following, which displays an acceptable splash screen on all of my test devices other than one. On that one, the image (@drawable/splash_screen) is clipped at left and right. How can I tweak the following to scale that image to use the available space (maintaining aspect ratio), whether that mean scaling up or scaling down in size?

  <style name="MainTheme" parent="MainTheme.Base">
    <item name="android:windowBackground">@drawable/splash_screen</item>
    <item name="android:colorBackground">@color/myapp_blue</item>
    <item name="android:buttonStyle">@style/NoShadowButton</item>
  </style>

HttpClient with WebApi is not working

Xamarin.UITests Image AutomationID adding extra space

$
0
0

When running UI Tests on Xamarin Forms project the automation ID for an image component adds a space at the end
Image Component:

<Image Grid.Row="1"
         Grid.Column="2"
         AutomationProperties.Name="StatusIcon"
         AutomationId="StatusIcon"
         HorizontalOptions="Center"
         VerticalOptions="Center"
         Source="ic_more_horiz.png" />

Test:

[Test]
        public void InputTextEntryDisplaysCheckmark()
        {
            app.EnterText(e => e.Marked("InputTextEntryField"), "45");
            app.Query();
            AppResult[] result = app.Query(e => e.Marked("StatusIcon"));
            Assert.IsTrue(result.Any(), "Checkmark is not visible");
        }

When running iOS UI Tests the component's AutomationId is always "StatusIcon" and the test passes
While running Droid UI Tests the component's AutomationId(label) becomes "StatusIcon " leading to the app.Query failing and therefore the test failing.

Does anyone know how to fix this so an AutomationProperties.Name and AutomationId can be set and the tests pass?

Notes:
If the AutomationProperties.Name is removed then the Droid AutomationId does not add the space ("StatusIcon") and the test passes.
The problem does not occur with other components (Entry,Label).


How to get Samsung Galaxy Emulators in VS MAC

$
0
0

Hi,

My app is build on Xamarin Forms. I need to test the app for Samsung Galaxy 8, but when I go to Android Emulator Manager and click on New Devices, I am not able to see any Samsung Device. Can someone help me how to get them?

Apk built ad hoc/signed is not asking for required permissions when downloaded and installed locally

$
0
0

Before I spend a lot of time hunting down a fix for this I just want to confirm whether or not this is a real issue that needs to be addressed. We can build the apk ad hoc and then put it directly on the phone, but it does not say it requires any permissions. The app then crashes when I visit a page where that's required. If I manually go to the permissions for the app after installing it and enable the permissions I see there the crashes go away once I revisit that page.

Is this an expected problem building and deploying locally that will not be present if I build it and upload it to the Play Store? If it's not where can I start to debug this problem? My android manifest lists the permissions I need and when I view the app permissions after installing the two I require are the only ones listed there so it seems as though everything besides actually asking the user for permission is working.

I saw this with a Galaxy S5 - 6.0.1 and a Galaxy A5 7.0.

Any help or insight would be appreciated, thanks.

DatePicker does not trigger "DateSelected" on default date selection in xamarin.forms - UWP

$
0
0


private void EndDatePicker_OnDateSelected(object sender, DateChangedEventArgs e)
{
var dateString = EndDatePicker.Date.ToString(SharedConstants.DateFormat);
//Do stuff
}

DatePicker default date is - CurrentDate

If the user selects any date other than current date and clicks done, the event is fired.
If the user leaves the date on today and clicks "Done" no event is fired.

Unfocused event is fired everytime the control looses focus and I cannot know whether it's after done or user just clicked cancel or outside the control.

I want to capture the "Done" event of the picker.

I am running the app on UWP. Is it achievable by creating a renderer or any other option?

I get an error in Master Detail page

$
0
0

So I create a standard xamarin form project with a default template, then I add a Master Detail page template to the project and when I compile this project on the phone I open the side menu and when I click on Page 1 I get the error "System.InvalidCastException: Specified cast is not valid. " I do not change the default template in any way, but I get an error, I believe that it is related to the transition to Page 1 and I do not understand by what principle this transition occurs. Thanks.

xamarin.forms android camera permissoins denied

$
0
0

Hi,

I am trying to take a photo with a tablet and keep getting 'permission denied'.
What did i do wrong?

camara status and storage status are both 'denied'.

private async void BtnTakePhoto_Clicked(object sender, EventArgs e)
{
await CrossMedia.Current.Initialize();

        if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
        {
            await DisplayAlert("No Camera", "No camera avaialble.", "OK");
            return;
        }

        try
        {
            var cameraStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Camera);
            var storageStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Storage);

            if (cameraStatus != PermissionStatus.Granted || storageStatus != PermissionStatus.Granted)
            {
                var results = await CrossPermissions.Current.RequestPermissionsAsync(new[] { Permission.Camera, Permission.Storage });
                cameraStatus = results[Permission.Camera];
                storageStatus = results[Permission.Storage];
            }

            if (cameraStatus == PermissionStatus.Granted && storageStatus == PermissionStatus.Granted)
            {
                var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
                {
                    Directory = "Sample",
                    Name = "test.jpg"
                });
            }
            else
            {
                await DisplayAlert("Permissions Denied", "Unable to take photos.", "OK");

                CrossPermissions.Current.OpenAppSettings();
            }
        }
        catch(Exception error)
        {
            await DisplayAlert("Alert!", error.ToString(), "OK");
            throw error;
        }

}

android manifest:

<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.CAMERA" />
<application android:label="Xamarin">
<provider android:name="android.support.v4.content.FileProvider"
                  android:authorities="com.test.Xamarin.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>

mainacticity:

namespace XMLSample.Droid
{
[Activity(Label = "test", MainLauncher = true, ScreenOrientation = creenOrientation.Landscape)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override async void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;

        base.OnCreate(bundle);

        await CrossMedia.Current.Initialize();

        global::Xamarin.Forms.Forms.Init(this, bundle);
        LoadApplication(new App());
    }

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

}

assemblyinfo

[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
[assembly: UsesPermission(Android.Manifest.Permission.Camera)]

[assembly: UsesFeature("android.hardware.camera", Required = false)]
[assembly: UsesFeature("android.hardware.camera.autofocus", Required = false)]

list view rows background color

$
0
0

Hello everyone
I want to achieve something like this using listview

does anyone know how to do this

all what i want is to make odd rows with the same color
thanks

PCL vs SL for school project Xamarin app

$
0
0

Hello,

I am not very advanced with Xamarin.Forms, but I have to do school project for multiplatform app. I will use Visual studio for Mac to create Xamarin.Forms App for iOS and Android.

What shared code system it is better to use? Portable class library or Shared library?

My app will have connection to database to work with data. I will use SQLite or MySQL.

I suppose easier approach could be PCL because there I can use nuget packages. What do you think?

Thank you.


getting error while rebuilding solution object reference not set to an instance in xamarin.ios

$
0
0

how to resolve this object reference not set to an instance in xamarin.ios

Opacity applying to all child elements of Layout

$
0
0

I'm trying to get an idea if this is supported behavior or is a bug.

I'm finding that if I set the opacity property on contentpage or stack layout to something say like 0.25. It automatically applies that same Opacity to all child elements of that view or page. I've tried setting the Opacity to 1 on the child elements but XF seems to ignore the setting. Either that or maybe it's being overwritten later. I'm not sure yet.

I'm encountering this issue on both UWP and my Android N phone using XF 3.0 pre 3.

I've not yet tried other versions of XF or iOS.

Is this expected behavior? Or does anyone in the community have any more experience with this before I spend a lot more time investigating this issue?

Space between listview header and first item

$
0
0

Hello,
I have listview with header and items but i couldn't find how to make a space between them.
Thanks

Android Binding library resource not found

$
0
0

I have created the binding library, when i implement the function and build the android application i getting below error.

No resource found that matches the given name (at 'textColor' with value '@color/bt_white').
No resource found that matches the given name (at 'background' with value '@color/bt_blue').
No resource found that matches the given name (at 'drawable' with value '@color/bt_black_12').

how to fix it

Disable rotation all pages except one

$
0
0

Hi,

All the solutions the i found about blocking rotation is global to all pages of the App, but my situation is different I wan't all pages to portrait except one that can be used in portrait or landscape.

Can you guys help me with this?

Viewing all 58056 articles
Browse latest View live


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