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

Extra space appearing on top of table view in IOS, how to eliminate this.

$
0
0

In xamarin forms-IOS, tableview extra space is appearing on top of table if intent="form" used whereas if intent has changed to 'data' extra space was removed but extra separator line are displaying. How to get out this issue.


Is there how to delete and add a new Droid Project in a PCL Project(Xamarin.Forms?

$
0
0

I use xamarin.form with visual studio 2017. I'm having some problem as for example, my droid project missed csproj. I made a question, but is possible two answer.

First -> My droid project just stopped. Can i add a new droid project in the same sln instead?

Second -> My .csproj is corrupted. Can i create a new .csproj file instead?

Custom ProgressBar style in Android

$
0
0

I want to add a custom style in Android to my Progressbar. I've added my custom style in the \Resources\values\styles.xml file.

But no change is seen, I'm not sure if it is android:progressBarStyleHorizontal that is wrong or if it is something else.

Here's my styles.xml file:

<?xml version="1.0" encoding="utf-8" ?>
<resources>

  <style name="MainTheme" parent="MainTheme.Base">
  </style>
  <!-- Base theme applied no matter what API -->
  <style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
    <item name="windowNoTitle">true</item>
    <!--We will be using the toolbar so no need to show ActionBar-->
    <item name="windowActionBar">false</item>
    <!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">#2196F3</item>
    <!-- colorPrimaryDark is used for the status bar -->
    <item name="colorPrimaryDark">#1976D2</item>
    <!-- colorAccent is used as the default value for colorControlActivated
         which is used to tint widgets -->
    <item name="colorAccent">#FF4081</item>
    <!-- You can also set colorControlNormal, colorControlActivated
         colorControlHighlight and colorSwitchThumbNormal. -->
    <!-- tillagt för att slippa den rosa färgen på en Switch i aktiverat läge -->
    <item name="colorControlActivated">#0CB9C0</item>

    <item name="windowActionModeOverlay">true</item>

    <item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
        <item name="android:progressBarStyleHorizontal">@style/mycustomProgressBarStyleHorizontal</item>
  </style>

  <style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
    <item name="colorAccent">#FF4081</item>
    <!-- tillagt för att slippa den rosa färgen på en Switch i aktiverat läge -->
    <item name="colorControlActivated">#0CB9C0</item>
  </style>

    <style name="mycustomProgressBarStyleHorizontal" parent="Widget.AppCompat.ProgressBar.Horizontal">
        <item name="android:minHeight">20dip</item>
        <item name="android:maxHeight">20dip</item>
        <item name="android:progressBackgroundTint">#69f0ae</item>
        <item name="android:progressTint">#b71c1c</item>
    </style>

</resources>

Xamarin.UWP UnhandledException Event Handler Never Gets Fired

$
0
0

In my App.xaml.cs ctor, I hooked up UnhandledException

this.UnhandledException += OnUnhandledException;

, then I provided handler to send error info to GoogleAnalytics

private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
    var unhandledException = e.Exception;
    AnalyticsManager.LogError("", e.Exception.Message, "UnhandledException");
}

I intentionally introduce '''DevideByZeroException''' in my code that is never handled and I would expect my '''OnUnhandledException''' handler to be called but that does not happen, regardless of Debug or Release mode. I put a break point in this handler and that break point is never reached.

Doing same on Xamarin.Android on the other hand will reach the breakpoint.

Nested dataBinding in xaml

$
0
0

In a ViewModel i have a property "Contacts" as a ObservableCollection. ContactDTO in turn has a List property "Friends" of type List.
I would know if i can databind in xaml the list of friends inside the ContactDTO, something like the following:

Text="{Binding Friends[0].Name}" // want to access the property Name of the first friend

Is it possible to do this type of databinding?

Pop / Removal all Modal Pages Behind Top Most

$
0
0

Currently we have two modals that show in order:

  • slideshow
  • login

My issue is I want to push a modal on top of the slideshow then pop the slideshow after it appears.

Right now I do the following:
1. Push slideshow modal (with animation)
2. Pop slideshow modal (no animation)
3. Push login modal (no animation)
4. Pop login modal (with animation) at end of UX

This works but there is a "blip" in between showing them.

What I want to do is:
1. Push slideshow modal (with animation)
2. Push login modal (no animation)
3. Pop slideshow modal after login modal appears
4. Pop login modal (with animation) at end of UX

If I use a while loop to pop the modals then you see them falling one by one.

I am able to remove earlier pages in the navigation stack with the following:
MyNavigationPage.Navigation.RemovePage(page);

However there does not seem to be a modal version of this.

I want to avoid a refactor when I combine the two Pages into one Page because of the custom rendered and complexity of my task at hand.

If this is not possible it should be.

How to find whether Listview scrolled up or down in xamarin forms?

$
0
0

I need to hide some view, when ListView scrolled up and display that view again, when list view scrolled down.

I used

private void MyListView_ItemAppearing(object sender, Xamarin.Forms.ItemVisibilityEventArgs e)
{
var currentItem = e.Item as MyModel;

        if (viewModel.MyList[0].Id == currentItem.Id)
        {
            SearchEntryLayout.IsVisible = true;

        }

}
private void MyListView_ItemDisAppearing(object sender, ItemVisibilityEventArgs e)
{
var currentItem = e.Item as MyModel;

        if (viewModel.MyList[0].Id == currentItem.Id)
        {

            SearchEntryLayout.IsVisible = false;            
        }
    }

Hide StackLayout On Scroll

$
0
0

Hey,

I need to implement a Stack Layout that hide when scrolling down in a listView and appear when scrolling up...

It is not the Nav Bar, it would be a normal stack Layout.

Any hints on how to do that?
Someone have already tried it?


How to implement MessagingCenter

$
0
0

Hello Everyone,

I have some difficulty understanding how the MessagingCenter works. I am trying to send encrypted username and password from my loginViewModel to another ViewModel.

In My loginViewModel I have this:

     private async void Encrypt_UserEncryptCompleted(object sender, ServiceReferenceEncrypt.UserEncryptCompletedEventArgs e)
            {
                auth.Username = e.Result;
                Device.BeginInvokeOnMainThread(() => MessagingCenter.Send<LoginViewModel, string>(this, "Username", e.Result));
                callPassEncryptWCF();          
            }

 private async void Encrypt_PassEncryptCompleted(object sender, ServiceReferenceEncrypt.PassEncryptCompletedEventArgs e)
        {
            auth.Password = e.Result;
            Device.BeginInvokeOnMainThread(() => MessagingCenter.Send<LoginViewModel, string>(this, "Password", e.Result));
            callWCF();
        }

On the other ViewModel I have this:

     MessagingCenter.Subscribe<LoginViewModel, string>(this, "Username", (login, username) => {
                            CheckMyLocationRequest.Username = username;
                        });
                        MessagingCenter.Subscribe<LoginViewModel, string>(this, "Password", (login, password) => {
                            CheckMyLocationRequest.Password= password;
                        });

I appreciate if you guide me on this!

Xamarin.forms resx localization is not working on android. AppResource.MyString returns empty string

$
0
0

Looks like xamarin.forms resx localization is broken. I followed the instructions here and with the latest sample template. But everytime access the loc string it returns empty string.

    <?xml version="1.0" encoding="utf-8"?>
    <root>
        <resheader name="resmimetype">
            <value>text/microsoft-resx</value>
        </resheader>
        <resheader name="version">
            <value>2.0</value>
        </resheader>
        <resheader name="reader">
            <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
        </resheader>
        <resheader name="writer">
            <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
        </resheader>

        <data name="HomeMenu2" xml:space="preserve">
            <value>Home2</value>
        </data>
    </root>

And this is how i am accessing it

label.Text = AppResources.HomeMenu2;

Is this known issue?

SkiaSharp crashes Android on startup

$
0
0

Hi there. I am working on a Xamarin.Forms PCL project where I decided to use SkiaSharp. I test the application using an android emulator (Android 7.1 - API 25), but after installing the SkiaSharo.View.Forms and its dependencies the app crashes on start up. This is the log:

Android application is debugging. 01-02 21:21:58.553 I/art ( 8376): Not late-enabling -Xcheck:jni (already on) 01-02 21:21:58.553 W/art ( 8376): Unexpected CPU variant for X86 using defaults: x86_64 01-02 21:21:58.591 D/AndroidRuntime( 8376): Shutting down VM 01-02 21:21:58.592 E/AndroidRuntime( 8376): FATAL EXCEPTION: main 01-02 21:21:58.592 E/AndroidRuntime( 8376): Process: com.companyname.Mit_Liv, PID: 8376 01-02 21:21:58.592 E/AndroidRuntime( 8376): java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.companyname.Mit_Liv-1/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.Mit_Liv-1/lib/x86_64, /system/fake-libs64, /data/app/com.companyname.Mit_Liv-1/base.apk!/lib/x86_64, /system/lib64, /vendor/lib64]]] couldn't find "libmonodroid.so" 01-02 21:21:58.592 E/AndroidRuntime( 8376): at java.lang.Runtime.loadLibrary0(Runtime.java:984) 01-02 21:21:58.592 E/AndroidRuntime( 8376): at java.lang.System.loadLibrary(System.java:1530) 01-02 21:21:58.592 E/AndroidRuntime( 8376): at mono.MonoPackageManager.LoadApplication(MonoPackageManager.java:34) 01-02 21:21:58.592 E/AndroidRuntime( 8376): at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:42) 01-02 21:21:58.592 E/AndroidRuntime( 8376): at android.app.ActivityThread.installProvider(ActivityThread.java:5853) 01-02 21:21:58.592 E/AndroidRuntime( 8376): at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445) 01-02 21:21:58.592 E/AndroidRuntime( 8376): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384) 01-02 21:21:58.592 E/AndroidRuntime( 8376): at android.app.ActivityThread.-wrap2(ActivityThread.java) 01-02 21:21:58.592 E/AndroidRuntime( 8376): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545) 01-02 21:21:58.592 E/AndroidRuntime( 8376): at android.os.Handler.dispatchMessage(Handler.java:102) 01-02 21:21:58.592 E/AndroidRuntime( 8376): at android.os.Looper.loop(Looper.java:154) 01-02 21:21:58.592 E/AndroidRuntime( 8376): at android.app.ActivityThread.main(ActivityThread.java:6119) 01-02 21:21:58.592 E/AndroidRuntime( 8376): at java.lang.reflect.Method.invoke(Native Method) 01-02 21:21:58.592 E/AndroidRuntime( 8376): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 01-02 21:21:58.592 E/AndroidRuntime( 8376): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

I tried downloading the SkiaSharp demos project, but I could not launch that either. Any ideas?

Xamarin Forms app launches on device in debug but crashes when loaded from Testflight

$
0
0

I have a Xamarin Forms app (v2.5.0) which I am attempting to run on an iPhone.

Currently when I run the app in the simulator or on the device (debugging through Visual Studio) the app loads without issue - however when I upload the app to itunes connect and download it via Testflight it crashes when the first screen is shown (I can see the first page for less than a millisecond)

I have crash reporting enabled through Microsoft App Center but nothing is ever reported (I'm guessing it crashes before it is able to send the crash reports) and when I look at the logs on the device it seems to only have a truncated crash report (Shown at the end of this post)

Has anyone else encountered this problem or have suggestions on how I might resolve / investigate further?

The crash from the device logs is as follows:

_{
"crashReporterKey" : "d82262ea260c0a28acde60599425a228b22e87bc",
"kernel" : "Darwin Kernel Version 17.3.0: Mon Nov 6 21:19:18 PST 2017; root:xnu-4570.32.1~1\/RELEASE_ARM64_T7000",
"product" : "iPhone7,1",
"incident" : "2F0A2547-BE42-4628-BCED-E9CE9E6E391D",
"date" : "2017-12-19 14:55:06.54 +0000",
"build" : "iPhone OS 11.2 (15C114)",
"timeDelta" : 8,
"memoryStatus" : {
"compressorSize" : 59066,
"compressions" : 64728367,
"decompressions" : 46277793,
"zoneMapCap" : 367853568,
"largestZone" : "APFS_4K_OBJS",
"largestZoneSize" : 21286912,
"pageSize" : 4096,
"uncompressed" : 167832,
"zoneMapSize" : 81780736,
"memoryPages" : {
"active" : 83439,
"throttled" : 0,
_

Grouped Header Binding looks like GroupShortNameBinding property not GroupDisplayBinding on UWP

$
0
0

Hi All,

When binding to a grouped list the GroupShortNameBinding property seems to be displayed in the GroupHeader rather than the GroupDisplayBinding property. My understanding was as per the documentation GroupDisplayBinding Property gets or sets the binding to use for display the group header and the GroupShortNameBinding to bind to the property of the groups used for the jump lists (right-side column on iOS, tile grid on Windows Phone).

I my example the GroupShortNameBinding is being bound as the GroupDisplayBinding, could this be a bug?

XAML snippet here ....

Note specifically

GroupDisplayBinding="{Binding Title}"
GroupShortNameBinding="{Binding ShortName}"

<ListView x:Name="ItemsListView" ItemsSource="{Binding Items}" VerticalOptions="FillAndExpand" HasUnevenRows="true" RefreshCommand="{Binding LoadItemsCommand}" IsPullToRefreshEnabled="true" IsRefreshing="{Binding IsBusy, Mode=OneWay}" CachingStrategy="RecycleElement" ItemSelected="OnItemSelected" GroupDisplayBinding="{Binding Title}" GroupShortNameBinding="{Binding ShortName}" IsGroupingEnabled="true"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <StackLayout Padding="10"> <Label Text="{Binding Text}" LineBreakMode="NoWrap" Style="{DynamicResource ListItemTextStyle}" FontSize="16" /> <Label Text="{Binding Description}" LineBreakMode="NoWrap" Style="{DynamicResource ListItemDetailTextStyle}" FontSize="13" /> </StackLayout> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView>

In my List the properties Title and ShortName are set as follows

//Setup Groups
Items.Add(new ItemGroup() { Title = "Odd", ShortName = "O" });
Items.Add(new ItemGroup() { Title = "Even", ShortName = "E" });
Items.Add(new ItemGroup() { Title = "Big", ShortName = "B" });

I would expect to see Odd, Even, Big in the group headers and O,E,B in the jump lists.

Instead, I only see O,E,B in both the headers and jump lists....

Anyone else seeing this?

Bots army

Localization for controls

$
0
0

Hi everybody!

I'm sure this is pretty simple, but how can I achieve that the controls are shown in German? When I use a date picker, the month values are shown in english by default.

In Android and iOS I could just set the CultureInfo, which is not possible anymore in Xamarin.Forms.

    var ci = new System.Globalization.CultureInfo ("de-DE");
    System.Threading.Thread.CurrentThread.CurrentCulture = ci;

Thank you!
Ronald


Overriding device locale for time and datepickers

$
0
0

Our app is available in 4 languages. Our app will use the device's language, unless it's not one of the 4 options, where we resort to using English. Our users can also override the device setting by selecting a language inside the app. Everything works fine except for the DatePicker and TimePicker. We set the locale with the following code:

Resx.AppResources.Culture = ci; // set the RESX for resource localization
DependencyService.Get<ILocalize>().SetLocale(ci); // set the Thread for locale-aware methods

The app still uses the device's set language for only the pickers. EX: Device locale English, app locale Spanish, DatePicker shows months in English.

Is there any way to override this?

Thanks

Can't build Blank Forms App template for Android

$
0
0

Can't build Blank Forms App template for Android

I am using 7.3.2 (build 12)
Use Shared Mono Runtime
Fast Assembly Deployment
Linker options: Don't Link
Target Framework Android 7.1
Using Shared Library and XAML

Any body else experiencing the same issues ?

`Errors:

/Users/jensengelbrecht/Documents/Mobisma/Xamarin/nextGClients/testapp1/Droid/testapp1.Droid.csproj (Build) ->
/Library/Frameworks/Mono.framework/Versions/5.4.1/lib/mono/xbuild/14.0/bin/Microsoft.CSharp.targets (CoreCompile target) ->

MainActivity.cs(14,64): error CS0234: The type or namespace name 'Android' does not exist in the namespace 'Xamarin.Forms.Platform' (are you missing an assembly reference?)
obj/Debug/testapp1.Droid..Users.jensengelbrecht.Documents.Mobisma.Xamarin.nextGClients.testapp1.testapp1.App.xaml.g.cs(14,28): error CS0234: The type or namespace name 'Xaml' does not exist in the namespace 'Xamarin.Forms' (are you missing an assembly reference?)
obj/Debug/testapp1.Droid..Users.jensengelbrecht.Documents.Mobisma.Xamarin.nextGClients.testapp1.testapp1.testapp1Page.xaml.g.cs(14,28): error CS0234: The type or namespace name 'Xaml' does not exist in the namespace 'Xamarin.Forms' (are you missing an assembly reference?)
/Users/jensengelbrecht/Documents/Mobisma/Xamarin/nextGClients/testapp1/testapp1/testapp1Page.xaml.cs(5,41): error CS0246: The type or namespace name 'ContentPage' could not be found (are you missing a using directive or an assembly reference?)
/Users/jensengelbrecht/Documents/Mobisma/Xamarin/nextGClients/testapp1/testapp1/App.xaml.cs(5,32): error CS0246: The type or namespace name 'Application' could not be found (are you missing a using directive or an assembly reference?)
obj/Debug/testapp1.Droid..Users.jensengelbrecht.Documents.Mobisma.Xamarin.nextGClients.testapp1.testapp1.testapp1Page.xaml.g.cs(16,63): error CS0234: The type or namespace name 'ContentPage' does not exist in the namespace 'Xamarin.Forms' (are you missing an assembly reference?)
obj/Debug/testapp1.Droid..Users.jensengelbrecht.Documents.Mobisma.Xamarin.nextGClients.testapp1.testapp1.App.xaml.g.cs(16,54): error CS0234: The type or namespace name 'Application' does not exist in the namespace 'Xamarin.Forms' (are you missing an assembly reference?)
/Users/jensengelbrecht/Documents/Mobisma/Xamarin/nextGClients/testapp1/testapp1/App.xaml.cs(14,33): error CS0115: 'App.OnStart()': no suitable method found to override
/Users/jensengelbrecht/Documents/Mobisma/Xamarin/nextGClients/testapp1/testapp1/App.xaml.cs(19,33): error CS0115: 'App.OnSleep()': no suitable method found to override
/Users/jensengelbrecht/Documents/Mobisma/Xamarin/nextGClients/testapp1/testapp1/App.xaml.cs(24,33): error CS0115: 'App.OnResume()': no suitable method found to override
MainActivity.cs(16,33): error CS0115: 'MainActivity.OnCreate(Bundle)': no suitable method found to override

 4 Warning(s)
 11 Error(s)`

unable to build iOS + Xamarin Forms + .Net Std 1.6.1

$
0
0

Getting below mention error, it started only after adding Xamarin.Auth

Ensure that this project has Microsoft.Bcl.Build installed and packages.config is located next to the project file.

I am using Visual Studio for mac 7.3.2 Build 12

Project dont have packages.config at all,

How to put in the MainPage an image .png

$
0
0

In the constructor i did

var image = new Image { Source = "Images/automotive.png" };

doesn't work. In the xaml i did:

<ContentPage.Content>
        <StackLayout Spacing="10" Orientation="Vertical" x:Name="MainLayout">
            <Image Source="Images/automotive.png"></Image>
        </StackLayout>
    </ContentPage.Content>

doesn't work too.

Images is a folder in my PCL project. What am i doing wrong?

how to fix the UITableViewRowAction appearance bug in Iphone 5 or Iphone 5s ios 9.x?

$
0
0

I have implemented a listview with table view row actions using custom renderer in ios. I have added two row actions with a different color. When I run the app, one of the row action has appearance issue, it consists of a red line in UI, which it should not.
I have created a sample app to reproduce this issue. Please find the attached project and screenshot for details
This is happening only in ios 9.x in Iphone

Viewing all 58056 articles
Browse latest View live


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