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

Azure, Google Auth client-directed flow

$
0
0

Hi All,
I'm developing a mobile app using xamarin forms. The server side is web api on azure, so the server api has various methods with the Authorize attribute set etc. The app is up and running with the 'server directed' authentication flow using Google as the provider but it's clunky and slow so I now wish to implement it with the client directed flow.
Can anyone point me at a sample that does this?
Ie Xamarin Forms, Azure, Web API, Google Authentication client-side

Many thanks


Getting System.Invalid Cast Exception while rendering the Navigation Page

$
0
0

Below code I'm using for rendering NavigationPage

[assembly:ExportRenderer(typeof(NavigationPage),typeof(CustomNavigationRenderer))]
namespace App4.Droid
{
public class CustomNavigationRenderer: NavigationRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);
}
}
}

Getting exception Invalid Cast Exception @ base.OnElementChanged(e);

For Reference I'm trying to do this
http://www.c-sharpcorner.com/uploadfile/e4bad6/remove-android-action-bar-icon-in-xamarin-forms812/

https://jessejiang.xyz/2016/01/17/how-to-change-the-navigation-page-back-icon/

How to find the image that is not found on iOS

$
0
0

Hi all,

I get this error:
System.Exception: Could not initialize an instance of the type 'MonoTouch.UIKit.UIImage': the native 'initWithContentsOfFile:' method returned nil.
It is possible to ignore this condition by setting MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure to false.
at MonoTouch.Foundation.NSObject.InitializeHandle (IntPtr handle, System.String initSelector) [0x000b0] in /Developer/MonoTouch/Source/maccore/src/Foundation/NSObject2.cs:399
at MonoTouch.UIKit.UIImage..ctor (System.String filename) [0x00026] in /Developer/MonoTouch/Source/monotouch/src/build/compat/UIKit/UIImage.g.cs:239
at Xamarin.Forms.Platform.iOS.FileImageSourceHandler.LoadImageAsync (Xamarin.Forms.ImageSource imagesource, CancellationToken cancelationToken, Single scale) [0x00000] in :0
at Xamarin.Forms.Platform.iOS.ImageRenderer+d__0.MoveNext () [0x00000] in :0

But only on a real device, not in the simulator. So best bet is that somewhere the filename case is wrong, or it might call Bundleresource instead of FileResource. I checked all filenames, and they seem to be OK. I checked multiple levels of the exception data to find any indication of the filename that is missing or is giving a problem. But as this is loaded async, settings breakpoints and debug messages did not help.

I checked if all files are set to BundleResource, and they are referred to by using ImageSource.FromFile (image-name)

Who is giving me a hint which image or resource could give me this trouble?

How to restore Page on Device screen in Xamarin Forms

$
0
0

Good time of day to all. Apologies if this question was already asked and answered, but I couldn't find any relevant references to it. I am working on a Xamarin Forms project, which requires some long running tasks on the background. As an implementation example I have used this:

arteksoftware.com/backgrounding-with-xamarin-forms/

I also have a subroutine, which analyses the completion state of the background task, and generates a set of actions, when the completion criteria is achieved, including a pop-up message on a device screen. All works well so far. However, if I minimize the App screen (and my App continues to run on the background), I can't find a way to restore the last Page in the Navigation stack, so it re-appears on the device screen. The Page should come back after the background task signals to do so (for example - on completion, etc.) How this can be done in Forms?

Embed a Power BI Tile into my app

$
0
0

Hello everybody,

I'm trying to embed a Power BI Tiles into my Xamarin.Forms app.

With the help of a web service and successful authentication I receive the required Embed url.

I tried it via WebView + HTML, but without success. (maybe i need a token for load the tile?!)

Maybe one of you has an idea

Best wishes
sid

MasterDetail: Hamburger icon no visible on UWP

Xamarin forms activity indicator

$
0
0

Is there a way in which we can use an activity indicator for entire page.
I want to use an activity indicator when a web service is called. Can we make the indicator to be on top of the page and blur the background and disable the elements on the entire page?

Multiline Title in Navigation Bar

$
0
0

Hello,

Is it possible to tweek navigation tool bar to have two line title (e.g. using custom page renderer)?

I need this only for Android platform.

Regards,
Novak


Android keyboard and the ContentPage view collapsing/expanding issue w/ Material Design

$
0
0

Hi, after I upgraded to 1.5.1 and getting material design in place, my app is working and looking great in Android. HOWEVER the view when focussing or unfoccusing the keyboard does not work as expected.

I have a Grid with icons at the bottom of my ContentPage. So when the keyboard expands the Grid should be sitting on top of the keyboard and the Editor shrinking in height to accomodate. As mentioned this worked before the Material Design update.

I am using the IosKeyboardFixPageRenderer from http://stackoverflow.com/questions/31172518/how-do-i-keep-the-keyboard-from-covering-my-ui-instead-of-resizing-it/31172519 for iOS and it works great.

How do I fix this on Android with Material Design?

Thank you

Issue with Xamarin.Forms 2.0.0.6482, IsVisible Binding when in AbsoluteLayout

$
0
0

In XAML:

<AbsoluteLayout>
    <ContentView IsVisible="{Binding IsContentVisible}" AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All">
        <Image Source="SomeImage"  />
    </ContentView>
</AbsoluteLayout>

When the IsContentVisible property changes, the ContentView becomes visible, however, the contained Image does not. Note that the problem only occurs if the ContentView is contained within an AbsoluteLayout. If there is no containing AbsoluteLayout, then the Image becomes visible as expected. The IsVisible value does appear to be propagating to the Image so I suspect it is a layout or measuring issue. This used to work pre 2.0+.

ListView Checkbox

$
0
0

Hi All,

Let's first i am explain my detail, i had fill my ListView and inside have one checkbox control.

Now my requirement is when I click on OK button then I need those CheckBox value(checked or not) which is checked in ListView

Please let me help Guys how can i do that.

Thanks in advance.

How to change Picker's Flyout color for Windows.

$
0
0

Hi,

I have my picker renderer, but there is no property to change the flyout color of a picker.

HttpClient not connecting to WCF REST Services in Windows Authentication

$
0
0

Hi Team,

We are working on product application to support android, iOS and Windows phone.

we have referred the below link for consuming WCF REST Services in application and its working fine without windows authentication.

https://developer.xamarin.com/guides/xamarin-forms/web-services/consuming/rest/

WCF REST Services are included with our own Web application and that is configured in IIS 7.0 Server.

For windows authentication we will configure the login page alone as Windows Authentication and other pages & WCF REST Services as anonymous authentication in IIS Server. But still we were not able to access the WCF REST Services in xamarin forms PCL project. ~~~~

Kindly find the below PCL code for reference.

public async Task<String> getStringDeserializedWithAuthentication(String functionName) //Helloworld
        {
            try
            {
                outputString = string.Empty;
                httpClient = new HttpClient( new HttpClientHandler() { UseDefaultCredentials = true } );
                var obj = new JObject();
                string s = obj.ToString();
                var json_object = JsonConvert.SerializeObject(s);
                httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", glbToken);
                String url = "http://192.168.0.215/Product/MobileService/EAMMobileService.svc" + "/" + functionName);
                System.Net.Http.HttpResponseMessage response = httpClient.PostAsync(new Uri(url), new StringContent(s, Encoding.UTF8, "application/json")).Result;
                using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
                using (var streamReader = new StreamReader(responseStream))
                {
                    string getstring = streamReader.ReadToEnd().ToString();
                    /* When configured a index page with windows authentication we are getting the below error message here */
                    /*<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
                        <HTML><HEAD><TITLE>Bad Request</TITLE>
                        <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
                        <BODY><h2>Bad Request</h2>
                        <hr><p>HTTP Error 400. The request is badly formed.</p>
                        </BODY></HTML>
                    */
                    outputString = (String)Newtonsoft.Json.JsonConvert.DeserializeObject(getstring, typeof(String));
                }
            }
            catch (Exception ex) { outputString = ex.Message.ToString();
            }
            return outputString;
        }

Kindly help us to access the WCF REST Services with windows authentication. (But we didn't do any windows authentication to WCF REST Service.svc file and done only Anonymous authentication to login page alone)

Thanks in Advance.

Best Regards,
Kathirvel M

Client flow for authorizations against Azure App Service

$
0
0

Hi all,

right now I have a working forms project in IOS and Android using Azure APP service with authentication based on the so called service flow, the one where the login is presented in a web view by the mobile service SDK. I need to change this to use the so called client flow. can any one point me at a working example of this in side forms on both IOS and android. I need to support live and google accounts.

ListView viewCell entry keyboard - binding bug with Android 7 (API 24)

$
0
0

See the example xaml below. This worked fine on API 23, but this morning my phone offered an Android 7 upgrade and I installed it. Now the binding / keyboard is buggy.

Basically, after editing the ItemName, when I enter data into the ExpectedQty or ActualQty entries the ItemName entry receives all the data being entered from the other entry controls. And i've noticed that the Numeric keyboard flashes up then is replaced by the text/default keyboard. Its as though the keyboard linked to the ItemName is being displayed, and hence the data is being fed to the itemname.

I've tried a few things like re-ordering the columns, using different keyboards, and it seems that the first column/keyboard always gets precedence and a similar problem occurs. I've uninstalled the app before redeploying..... cleaned the solution, deleted obj/bin..... before rebuilding.

I've proved this is definitely new to API 24. I created an emulator with API 24 and the same problem occurred. I installed the app on a Android 6.0.1 device and the problem doesn't occur, which makes sense because I haven't touched the related code for a while.

I tried upgrading to the latest version of Xamarin forms (2.3.1.114) and it didn't help.


<ListView.ItemTemplate>



              <Entry Placeholder=""
                            Text="{Binding ExpectedQty,Converter={StaticResource DecimalConverter}}"
                            Keyboard="Numeric"
                            WidthRequest="60"/>
              <Entry Placeholder=""
                            Text="{Binding ActualQty,Converter={StaticResource DecimalConverter}}"
                            Keyboard="Numeric"
                            WidthRequest="90"/>

Android: Page objects not removed from memory

$
0
0

In our Forms application we have the problem that some pages are created anew every time you open them, but they never get destroyed. The constructors get called many times, but some destructors never (I added those destructors only to see what happens).

So I tested it with an example I downloaded from https://developer.xamarin.com/samples/xamarin-forms/Navigation/Hierarchical/ I added to each constructor a System.Diagnostics.Debug.WriteLine("Page1Xaml"); and added a destructor like
~Page1Xaml()
{
System.Diagnostics.Debug.WriteLine("~Page1Xaml");
}

In iOS this example works fine. From time to time you see the destructors being called. But in Android no destructor gets called at all.

Is this an error in Xamarin Forms?

Google Auth Error:disallowed_useragent

$
0
0

I am getting Google Auth Error:disallowed_useragent in iOS when I try to authenticate google login using xamarin.auth.Google Document says Google has changed its Oauth policies, with this it is intended that no native web views initiate Oauth flows.So now, how to authenticate google login using xamarin.auth ?

Unable to resolve dependencies. 'Xamarin.Android.Support.Design 24.2.1'

$
0
0

I see this error in VS2015 after having installed Xamarin and the SDK for Native Xamarin Apps:

Unable to resolve dependencies. 'Xamarin.Android.Support.Design 24.2.1' is not compatible with 'Xamarin.Forms 2.3.2.127 constraint: Xamarin.Android.Support.Design (= 23.3.0)'.

How do I install the newer version of Xamarin.Android.Support.Design?

Xamarin.Forms 2.3.4.184-pre1

$
0
0

We've pushed Xamarin.Forms 2.3.4.184-pre1 to nuget. To install the pre-release, check the pre-release option in your nuget manager and install this version.

If you’ve got a bug to report, drop us a quick report here so we can troubleshoot in detail.

Important notes

  • Xamarin.Forms 2.3.4 depends on a Xamarin installation of Cycle 9. Users upgrading from Xamarin.Forms 2.3.3 (or earlier) will experience numerous compile errors if they attempt to build without first upgrading their Xamarin installation.

  • When upgrading Xamarin.Forms, take care not to simply "update all" as that will update the Xamarin.Android.Support packages to an incompatible version. More info here.

2.3.4.184-pre1

For all the details, please read the release post here. There is SO much goodness in this release, it's actually too long for the forum.

Not able to add WCF service reference .

$
0
0

Trying to WCF service reference. Getting Below error.
"This service cannot be consumed by the current project. Please check if the project target framework supports this service type."
Please provide solution

Viewing all 91519 articles
Browse latest View live


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