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

Xamarin Forms iOS Button Click Event is not Firing when the keyboard is open

$
0
0

Hi All,

I have a login view with a UserName & Password field and a Login Button.

While entering UserName & Password the keyboard opens and when i click login now, the click event is not getting called. Only the keyboard is getting hidden. Now when i click login it works.

Seems like, if the keyboard is open and a button is pressed, it takes it as a screen touch event and closes the keyboard, but doesn't call the click event.

This is happening after i upgraded to the latest version of Xamarin.

Please advise.

Thanks,
Manoj


What would cause Java.Lang.OutofMemory exception after multiple PopAsync and Back calls?

$
0
0

I have a couple of pages with different information that is all driven from a GridLayout. After going to couple of different pages I get an Unhandled Exception.

Java.Lang.OutOfMemoryError: Failed to allocate a 12538892 byte allocation with 4025888 free bytes and 3MB until OOM

MR.Gestures handles ALL touch gestures

$
0
0

With MR.Gestures you can handle the Tapping, Tapped, DoupleTapped, LongPressing, LongPressed, Panning, Panned, Swiped, Pinching, Pinched, Rotating and Rotated gestures on all layouts, cells, views and on the ContentPage.

The code can be as easy as

    var box1 = new MR.Gestures.BoxView { Color = Color.Red };
    box1.LongPressed += (s, e) => { Console.WriteLine("Code: Red LongPressed"); };

Or in XAML


<mr:ContentView xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:mr="clr-namespace:MR.Gestures;assembly=MR.Gestures" x:Class="GestureSample.Views.ContentViewXaml" Padding="50" TappingCommand="{Binding TappingCommand}" TappedCommand="{Binding TappedCommand}" DoubleTappedCommand="{Binding DoubleTappedCommand}" LongPressingCommand="{Binding LongPressingCommand}" LongPressedCommand="{Binding LongPressedCommand}" PanningCommand="{Binding PanningCommand}" PannedCommand="{Binding PannedCommand}" SwipedCommand="{Binding SwipedCommand}" PinchingCommand="{Binding PinchingCommand}" PinchedCommand="{Binding PinchedCommand}" RotatingCommand="{Binding RotatingCommand}" RotatedCommand="{Binding RotatedCommand}" >

MR.Gestures is available via NuGet. More info on http://www.mrgestures.com/.

There is also a sample app available to download from https://github.com/MichaelRumpler/GestureSample. The GestureSample demonstrates how to use all the gestures with all Xamarin.Forms elements.

VS2015 stops debugger after iOS app is launched

$
0
0

I'm seeing this error at random times. When it starts happening, it happens consistently unless I restart VS. The issue is that when the app is launched, debugger stops with a message in the console:

Launching 'AppXiOS' on 'xyz's iPhone'...
Launched 'AppXiOS' successfully on 'xyz's iPhone'...
The app has been terminated.

iOS device keeps running the app, but VS has no connection to it anymore.

The problem about pushing message in my Xamarin.Forms project.

$
0
0

Hi,guys
Er,A simple question.
I want to push message in my Xamarin.Forms project(PCL).I find some people use Push Notification Plugin for Xamarin.It is clientside(android,ios,wp platforms) plugin.
My simple question is server side use what? Any demo or suggestion is ok.
Thx!

Cross platform detect user inactivity.

$
0
0

Hi i have one settings based time that will automatically loggoff user.

I want to reset this timer when user:

  • Tap on screen
  • Click on button
  • Do something else (for this I know)

How can I subscribe to "TapScreen" and "KeyPressed" events?

Xamarin.Forms Apps Styling

$
0
0

Hi is there any out of box (even not official) app styling for Xamarin.Forms?

Method 'BindableObject.add_PropertyChanged' not found

$
0
0

Hi there,

I recently switched from Xamarin Studio to Visual Studio, now that it's free. Since then though I'm having no luck debugging my application.

Exception: System.MissingMethodException
Error message: "Method 'BindableObject.add_PropertyChanged' not found."
Line: this.LoadApplication(new FormsApp()); with this being MainActivity and FormsApp a Xamarin Forms Application class; potentially also when exiting OnCreate if debugger weirdness is considered

I stepped through all of my code to no extent, the error has to be somewhere in the framework as it occurs after stepping out of the line given above.

Plugins/Versions:

SQLite.NET 1.0.11
Xamarin.Forms 2.1.0.6526


Displaying PDFs possibly Word/Excel docs in iOS?

$
0
0

I am trying to write a file to the local storage of the device, and then open and view it some how. I've tried to use a custom webview and rendering but so far no luck. Currently using Environment. GetFolderPath (Environment.SpecialFolder.Pesonal) as the file path to write the file to and then read from. Has anyone gotten something like this to work? a file launcher of sorts.

Add Monomac references in xamarin forms

$
0
0

Guys,

Can i add the Monomac reference in xamarin forms i.e in App delegate. As i want to use in NSAppleEventManager in my project. Another solution is also welcome.

Navigate to map and when I navigate back it crashes the app ???

$
0
0

Hey everyone..... I have a map icon in the toolbar on iOS and when I click on it I open a map like so..

Navigation.PushAsync(new PropertyMap(inspectionPackage.CustomerDetails));

The page shows fine and when I click on the back navigation link the app crashes......

Have I implemented this incorrectly?

Xamarin Studio Version 6.0.1 (build 9)
Xamarin Forms 2.3.0.49
Xamarin Maps 2.3.0.49

Xamarin.Forms Apps Styling

$
0
0

Hi,

Is there any out of box (even not official) styling for Xamarin.Forms apps?

XLabs - Error CS0117 'Resource.Attribute' does not contain a definition for ....

$
0
0

I am trying to update Xamarin.Forms from version="2.1.0.6529" to "2.2.0.31"
After the nuget update I get a bunch of error from Xlabs in the Resource.Designer.cs

Here are my packages

<package id="Acr.DeviceInfo" version="3.0.0" targetFramework="monoandroid5" />
  <package id="ExifLib.PCL" version="1.0.1" targetFramework="monoandroid5" />
  <package id="FreshMvvm" version="0.0.5" targetFramework="monoandroid51" />
  <package id="Newtonsoft.Json" version="7.0.1" targetFramework="monoandroid5" />
  <package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Android.Support.v7.AppCompat" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Android.Support.v7.CardView" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Android.Support.v7.MediaRouter" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Android.Support.v7.RecyclerView" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Android.Support.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
  <package id="Xamarin.Forms" version="2.2.0.31" targetFramework="monoandroid60" />
  <package id="Xamarin.GooglePlayServices.Base" version="25.0.0.0" targetFramework="monoandroid5" />
  <package id="Xamarin.GooglePlayServices.Location" version="25.0.0.0" targetFramework="monoandroid5" />
  <package id="Xamarin.GooglePlayServices.Maps" version="25.0.0.0" targetFramework="monoandroid5" />
  <package id="XLabs.Core" version="2.0.5782" targetFramework="monoandroid60" />
  <package id="XLabs.Forms" version="2.0.5782" targetFramework="monoandroid60" />
  <package id="XLabs.IoC" version="2.0.5782" targetFramework="monoandroid60" />
  <package id="XLabs.Platform" version="2.0.5782" targetFramework="monoandroid60" />
  <package id="XLabs.Serialization" version="2.0.5782" targetFramework="monoandroid60" />
  <package id="XLabs.Serialization.JSON" version="2.0.5782" targetFramework="monoandroid60" />

My Compile and Target are Android 6.0. Any ideas?

1>Resources\Resource.Designer.cs(2016,124,2016,150): error CS0117: 'Resource.Attribute' does not contain a definition for 'mediaRouteSettingsDrawable'
1>Resources\Resource.Designer.cs(2178,118,2178,146): error CS0117: 'Resource.Color' does not contain a definition for 'design_textinput_error_color'
1>Resources\Resource.Designer.cs(2291,121,2291,144): error CS0117: 'Resource.Dimension' does not contain a definition for 'design_fab_content_size'
1>Resources\Resource.Designer.cs(2301,135,2301,172): error CS0117: 'Resource.Dimension' does not contain a definition for 'design_navigation_padding_top_default'
1>Resources\Resource.Designer.cs(2314,118,2314,138): error CS0117: 'Resource.Dimension' does not contain a definition for 'design_tab_min_width'
1>Resources\Resource.Designer.cs(2315,123,2315,148): error CS0117: 'Resource.Dimension' does not contain a definition for 'dialog_fixed_height_major'
1>Resources\Resource.Designer.cs(2316,123,2316,148): error CS0117: 'Resource.Dimension' does not contain a definition for 'dialog_fixed_height_minor'
1>Resources\Resource.Designer.cs(2317,122,2317,146): error CS0117: 'Resource.Dimension' does not contain a definition for 'dialog_fixed_width_major'
1>Resources\Resource.Designer.cs(2318,122,2318,146): error CS0117: 'Resource.Dimension' does not contain a definition for 'dialog_fixed_width_minor'
1>Resources\Resource.Designer.cs(2324,138,2324,178): error CS0117: 'Resource.Dimension' does not contain a definition for 'mr_media_route_controller_art_max_height'
1>Resources\Resource.Designer.cs(2414,111,2414,126): error CS0117: 'Resource.Drawable' does not contain a definition for 'ic_setting_dark'
1>Resources\Resource.Designer.cs(2415,112,2415,128): error CS0117: 'Resource.Drawable' does not contain a definition for 'ic_setting_light'
1>Resources\Resource.Designer.cs(2426,115,2426,134): error CS0117: 'Resource.Drawable' does not contain a definition for 'mr_ic_settings_dark'
1>Resources\Resource.Designer.cs(2427,116,2427,136): error CS0117: 'Resource.Drawable' does not contain a definition for 'mr_ic_settings_light'
1>Resources\Resource.Designer.cs(2447,87,2447,90): error CS0117: 'Resource.Id' does not contain a definition for 'art'
1>Resources\Resource.Designer.cs(2451,91,2451,98): error CS0117: 'Resource.Id' does not contain a definition for 'buttons'
1>Resources\Resource.Designer.cs(2468,105,2468,126): error CS0117: 'Resource.Id' does not contain a definition for 'default_control_frame'
1>Resources\Resource.Designer.cs(2470,94,2470,104): error CS0117: 'Resource.Id' does not contain a definition for 'disconnect'
1>Resources\Resource.Designer.cs(2496,109,2496,134): error CS0117: 'Resource.Id' does not contain a definition for 'media_route_control_frame'
1>Resources\Resource.Designer.cs(2497,100,2497,116): error CS0117: 'Resource.Id' does not contain a definition for 'media_route_list'
1>Resources\Resource.Designer.cs(2498,109,2498,134): error CS0117: 'Resource.Id' does not contain a definition for 'media_route_volume_layout'
1>Resources\Resource.Designer.cs(2499,109,2499,134): error CS0117: 'Resource.Id' does not contain a definition for 'media_route_volume_slider'
1>Resources\Resource.Designer.cs(2509,94,2509,104): error CS0117: 'Resource.Id' does not contain a definition for 'play_pause'

Exception AddPropertyChanged

$
0
0

Hi guys,

I´m developing an app with Xamarin.Forms and I´m debugging in Android System . I have the problem that appears in the picture when I start the application and call the App file from Portable project.

Have you got any ideas where is the problem?

If you need more information not doubt to ask me.

Greetings.

NavigationPage, PushModalAsync and back button

$
0
0

Its a Xamarin Forms app that I'm testing in android.

I have a tabbed page with a list item, when user clicks in list item I show a modal new page. Shomething like

private void NewsListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
var navigationPage = new NavigationPage(new NewsDetailPage());
Navigation.PushModalAsync(navigationPage,true);
}

I need to use PushModalAsync because if I use pushAsync it shows me the tabs in new page. Everything works well but it doesnt show back button in the navigation bar and I need it to come back. If I press back button in bottombar it works well.
I have tried several things: NavigationPage.SetHasBackButton, NavigationPage.SetHasNavigationBar...but they doestn works. How I can show the back button?

I dont know if I need to create a toolbaritem...in this case Do I need add the image of the left arrow etc or are there a predefinied item for that?

Thanks


Set two images to a button?

$
0
0

Hi, I'm trying to set two images in a button. something like SetCompoundDrawablesWithIntrinsicBounds for Android. But applied to Xamarin.Forms

Can you help me? Thanks

ModenHttpClient issues

$
0
0

I am trying to use ModernHttpClient to replace the HttpClient. But I noticed some issues on Android and iOS platform. Not sure if I am not using them correctly and hope I can get some help here. The below code works well with HttpClient (using HttpClientHandler instead of NativeMessageHandler)
Thanks in advance.

The issues on Android:
I found even I set AllowAutoRedirect = false when creating the http handler, it still does the autoredirect.

The issue on iOS:
it failed to retrieved the cookies using the below code even I can debug and see the cookie in the response on iOS

The code like below :

 public async Task<string> Login(string EmailAddress, string Password)
        {
            var postData = new List<KeyValuePair<string, string>>
            {
                new KeyValuePair<string, string>("j_username",EmailAddress),
                new KeyValuePair<string, string>("j_password", Password),
                new KeyValuePair<string, string>("_spring_security_remember_me", "yes"),
                new KeyValuePair<string, string>("spring-security-redirect", "")
            };
            HttpContent postContent = new FormUrlEncodedContent(postData);
            CookieContainer cookieContainer = new CookieContainer();

            try
            {
                using (NativeMessageHandler= new NativeMessageHandler()  //using ModernHttpClient replaced Httpclient
                {
                    CookieContainer = cookieContainer,
                    AllowAutoRedirect = false,
                    UseCookies = true
                })
                using (HttpClient httpClient = new HttpClient(httpHandler))
                {                   
                    httpClient.DefaultRequestHeaders.Add("Accept-Language", "en-US,en;q=0.8");
                    httpClient.DefaultRequestHeaders.Add("Accept-Encoding", "gzip, deflate");

                    string LoginUrl = BaseUrl + "/j_spring_security_check_2";
                    var response = await httpClient.PostAsync(LoginUrl, postContent);

                    if (response != null && response.StatusCode == HttpStatusCode.Found)  // here on Android, i always http 200 instead of http 302
                    {
                        string token = string.Empty;
                        var responseCookies = cookieContainer.GetCookies(new Uri(BaseUrl));// here on iOS, responseCookies always contains 0 cookies
                        foreach (Cookie cookie in responseCookies)
                        {
                            if (cookie.Name.Equals("grails_remember_me", StringComparison.OrdinalIgnoreCase))
                            {
                                token = cookie.Value;
                            }
                        }

                        return token;
                    }                   
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("PostRequestAsync exception {0}", ex.ToString());
            }
            return String.Empty;
        }  
}

Bind a Command from list view itemTemplate (MenuItem)

$
0
0

Hi all,

I have a list view, and I am using Xamarin Forms Content Actions functionality to add some swipe functionality.

        var moreAction = new MenuItem { Text = "Add Result", };
        ContextActions.Add (moreAction);

This is the code added on the itemTemplate of the listview.

The thing is I don't need to delete, I need to somehow bind this button to a ViewModel class (the same viewModel as the page displaying the list view), so I can navigate to a new page and allow the user to add some information to the record (it will be a REST request).

Anyone has any ideas on how i could achieve this? I'd greatly appreciate it!

Thanks!

How to clear Navigation Stack on Windows phone

$
0
0

Hello,

I am facing a problem with the Navigation Stack on Windows phone. I have a Main Menu Page which is root page in Navigation stack, from there I navigate to Page A --> Page B --> Page C. Now on Page C, I have a button for Main Menu Page. Once Main Menu Page appears, user can not go back to Page C by using device back button. Navigation.popToRootAsync is not working in Windows phone. How Can I achieve this guys ? Please help me out. Thanks in advance.

Load ResourceDictionary without App.xaml / App.xaml.cs structure

$
0
0

Hi,

Our enterprise application has a lot of projects and we have derived types around Application, Activity, and AppDelegate, etc. We also have a core/custom split of resources (xml key/value pairs) that I'm trying to migrate to XAML.

My question is, can I do something like this in Xamarin.Forms?:

Application.Current.Resources = {Load Core ResourceDictionary XAML};
Application.Current.Resources.MergedWith = typeof(Hello.World.CustomResourceDictionary);

So in other words, we might have a base textbox background color that each customization overrides using MergedWith.

Is it possible to do the above WITHOUT having to do:

<Application
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="Hello.World.App">
  <Application.Resources>
    <ResourceDictionary>
      ...
    </ResourceDictionary>
  </Application.Resources>
</Application>

I just want the two dictionaries in the format:

<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
                    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                    x:Class="Hello.World.CoreTheme">
    <Style TargetType="Label">
        <Setter Property="TextColor" Value="Blue" />
    </Style>
</ResourceDictionary>

Thanks in advance,

Peter.

Viewing all 81910 articles
Browse latest View live


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