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

SignalR client does not connect when the cell phone is at 3g/4g

$
0
0

Hello guys, I have a problem and I would like to know if anyone has been through something similar.

I'm using SIGNALR to develop a chat application similar to Whatsapp, everything works fine, the point is that I found that when the cell phone is at 3g / 4g I can't establish communication with the server's HUB, this in the Android project. On the Android emulator it even works, but on my phone (Xiaomi MI 9) it doesn't. It displays this error: "unable to complete handshake with the server due to an error: handshake was canceled."

Has anyone ever experienced this?


Binding FFImage BorderHexColor is now working

$
0
0
             ffImage:CachedImage x:Name="imgAuthor"
                                  Success="imgAuthor_Success"
                                  Source="{Binding ProfileImage}"
                                  HeightRequest="40">

                 ffImage:CachedImage.Transformations
            fTransformations:CircleTransformation BorderHexColor="{Binding CategoryBg}" BorderSize="5" 

             ffImage:CachedImage.Transformations

             ffImage:CachedImage

Center content horizontally in xamarin forms DataGridColumn After wraping text

$
0
0


If the content is not wrapping the text will be centered however when the text wraps it will only alight to the left.

        columns.Add(new DataGridColumn { Title = StringConstants.StatusTitle, PropertyName = StringConstants.StatusProperty, HorizontalContentAlignment = LayoutOptions.Center,  Width =  new GridLength(0.35, GridUnitType.Star) });

Basic Local Storage - How to?

$
0
0

Hi,

I have seen sqlite but I am asking what if I want a simple local storage just to save one variable user_id to determine the user ID?

What's the best way yo do it so even if the user closes the app or the phone it will still be stored?

Kindly advise...

Thanks,
Jassim

Xamarin.Auth in UWP

$
0
0

Hello,

I’m trying to implement Xamarin.Auth (OAuth 2) with Google in UWP.
After login, the browser close and I go back to my app but the event “Completed” is not fired.

Here is my code :

The “ButtonClicked” event of my “Google Login” button :

if (Device.RuntimePlatform == Device.UWP || Device.RuntimePlatform == Device.iOS)
{
App.OOAuth = new OAuth2Authenticator(App.CIdClientGoogleIOSUWP,
string.Empty,
"email",
new Uri(App.CUrlAuthorizeGoogle),
new Uri(App.CUrlRedirectGoogleIOSUWP.Trim()),
new Uri(App.CUrlTokenGoogle),
isUsingNativeUI: true);
}

App.OOAuth.Completed -= AuthGoogle_Completed;
App.OOAuth.Completed += AuthGoogle_Completed;

var presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter();
presenter.Login(App.OOAuth);

My redirect url is custom : “com.XXXX.apps:/oauth2redirect”.

I added the right protocol in “Package.appxmanifest” :

  <Extensions>
    <uap:Extension Category="windows.protocol">
      <uap:Protocol Name="com.XXXX.apps" />
    </uap:Extension>
  </Extensions>

In “App.xaml.cs” of the UWP project, I overrided the OnActivated event :

protected override void OnActivated(IActivatedEventArgs args)
    {
        Frame rootFrame = Window.Current.Content as Frame;

        // Do not repeat app initialization when the Window already has content,
        // just ensure that the window is active
        if (rootFrame == null)
        {
            // Create a Frame to act as the navigation context and navigate to the first page
            rootFrame = new Frame();

            rootFrame.NavigationFailed += OnNavigationFailed;

            Xamarin.Forms.Forms.Init(args);

            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                //TODO: Load state from previously suspended application
            }

            // Place the frame in the current Window
            Window.Current.Content = rootFrame;
        }

        if (args.Kind == ActivationKind.Protocol)
        {
            var protocolArgs = args as ProtocolActivatedEventArgs;
            rootFrame.Navigate(typeof(MainPage), protocolArgs.Uri);
        }
        else
        {
            rootFrame.Navigate(typeof(MainPage));
        }

        // Ensure the current window is active
        Window.Current.Activate();
    }

So, the redirection is Ok but my event “AuthGoogle_Completed” is not triggered.

Did I do something wrong ? Or did I miss something ?

Thanks in advance for your help.

Can the XAML Previewer be used for coded UI?

$
0
0

Or is using the emulator the only way to do this?

Custom StackLayoutList with a Custom Behavior?

$
0
0

I have three lists and a custom behavior. The first two look like the following:

<ListView x:Name="DispatchMapList"
                              ItemsSource="{Binding ItemSource_GeoCalls, Mode=OneWay}"
                              HasUnevenRows="True"
                              SeparatorVisibility="None"
                              BackgroundColor="Transparent"
                              IsVisible="{Binding IsVisible_CallsTab}"
                              Grid.Row="2"
                              RowHeight="190">
                        <ListView.Behaviors>
                            <behaviors:SelectedItemEventArgsToSelectedItemConverter
                                EventName="ItemSelected"
                                Command="{Binding GoToZoomFocusedMode}"
                                Converter="{StaticResource SelectedItemConverter}" />
                        </ListView.Behaviors>

I'm having an issue with the third list because it is a custom control:

<customcontrols:StackLayoutList x:Name="DispatchMapUnitList"
                                                        WidthRequest="600" VerticalOptions="FillAndExpand"
                                                        ItemsSource="{Binding ActiveUnits}"
                                                    BackgroundColor="{DynamicResource Key=invertableWhite}"
                                                        GroupingProperty="GroupDisplayName">

I'd like to add the same behavior to this custom control so it functions like the standard listview. The click event on the list item is received in the ViewModel. For some reason the GestureRecognizer is not working, so I am trying to implement something along the lines of the following with the custom StackLayoutList:

<customcontrols:StackLayoutList.Behaviors>
                                <behaviors:SelectedItemEventArgsToSelectedItemConverter
                                    EventName="ItemSelected"
                                    Command="{Binding GoToZoomFocusedMode}"
                                    Converter="{StaticResource SelectedItemConverter}"/></customcontrols:StackLayoutList.Behaviors>

My question is how can I hook this up in the custom control? My goal is to get a click event that is received in GoToZoomFocusedMode in the ViewModel.

Help with Embedding Power BI into Xamarin Forms

$
0
0

Hi Guys,

I am so very close to getting PowerBi Embedded to work in Xamarin forms, at the moment all I am getting is the Power BI Loading symbol. As you can see from the below image.

I think this is because I need to submit my token to the page somehow, I have a token but need someway of doing it. The way this was done on another app of mine was to use a ActiveX postMessage. I'm not sure if I need to do something similar but with WebView.Eval() and Javascript.

Any help is appreciated,

Thanks


Problem when updating Xamarin.Forms 5.0.0.2012

$
0
0

When updating Xamarin.Forms (5.0.0.2012) i have this issue
Method not found: System.Func`2<string, string> Xamarin.Forms.Internals.ResourceLoader.get_ResourceProvider() and i can't found the solution.

Loading More Items with Grouping Listview

$
0
0

Hi guys,

Currently, my app needs to display items into 4 groups. Everytime I send a request to the server, it will return a list of 10 items so that If I need to get more items, I have to use the ItemAppearing method(which is provided by Xamarin). But the problem is imagine your list is [Item 1,Item 2,...Item 10] and we have 4 groups A,B,C,D .Items will be grouped like this:
-Group A: Item 0, Item 1
-Group B: Item 5, Item 7, Item 9
-Group C: Item 3, Item 6
-Group D: Item 2, Item 4, Item 8.
As we can see that the last item displaying on the screen will be the last item of Group D and its ID will always be different from the last item of ItemSources, this will make the app always call the server to get more items(we need to display a loading mask to cover all the page) and in case server always return new data, you will never touch the last item of Group D. Could you guys please help me with this situation?

Best regards.

Google Login doesn't redirect back to app

$
0
0

Well, First then nothing, I don't speak english very well..

My problem is the next, I'm trying to implement a Google Login in my app, with next two references:
1. https://jorgediegocrespo.wordpress.com/2018/12/19/login-en-google-desde-xamarin-forms/
2. timothelariviere.com/2017/09/01/authenticate-users-through-google-with-xamarin-auth/

Well, when I select a google account the next page that appear "google.com", and I dontn't knows why.

First: OPEN THE NATIVE BROSER

Seccond: com.companyname.Auth, is my package android name in the AndroidManifest.xml

Next, When I select an account appear this page with a label "Espera un momento ~ Wait a moment"

And for last appear the Google homepage and don't return to my App :(

When I close the Navigation native Browser appear this Message

In Google Developer Console my OAth Consent Screem is this:

When I call the OAth2 Constructor the redirect URL than i use is this:
com.companyname.Auth:/oauth2redirec

My Source is the same than the first url reference:

I used in one moment the video tutorial of Houssem Dellai...

https://youtube.com/watch?v=AgFIsVr26zg

In his tutorial he uses a webview in the shared code, but i readed that google don't admit this solution now, and when i run the webview i have another error from Google.

I don't understand what is my problem.. i have several days trying this :( please help!!

The Height of the Image does not adjust

$
0
0

Good Day All

i have a Collection view defined like this

 <CollectionView x:Name="profileStatusList" HeightRequest="120" VerticalOptions="Start" HorizontalOptions="Center" Grid.Row="0" Margin="5,10,0,0">
                <CollectionView.ItemsLayout>
                    <LinearItemsLayout Orientation="Horizontal" />
                </CollectionView.ItemsLayout>
                <CollectionView.ItemTemplate>
                    <DataTemplate>
                        <StackLayout Orientation="Vertical" HorizontalOptions="Start" Spacing="10" Margin="10" >
                            <Grid>
                                <Frame  CornerRadius="35"  HeightRequest="61" WidthRequest="61" BackgroundColor="{StaticResource PrimaryColor}"  HorizontalOptions="Center" VerticalOptions="Start" Padding="2" IsClippedToBounds="True">
                                    <Frame CornerRadius="35" BorderColor="{StaticResource PrimaryColor}" HeightRequest="60" WidthRequest="60" HasShadow="True" HorizontalOptions="Start" VerticalOptions="Center" Padding="0">
                                        <Image HeightRequest="61" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Source="{Binding PHOTO_URL}" Opacity="1" Aspect="AspectFill"></Image>
                                    </Frame>
                                </Frame>
                                <Image HorizontalOptions="End" VerticalOptions="End" IsVisible="{Binding  CURRENT_USER}">
                                    <Image.Source>
                                        <FontImageSource Glyph="&#xF055;" FontFamily="fa-solid"  Size="Large" Color="{StaticResource PrimaryColor}" />
                                    </Image.Source>
                                </Image>
                            </Grid>
                            <Label Text="{Binding USERNAME}" TextColor="Gray" VerticalOptions="End" HorizontalOptions="Center" ></Label>
                            <StackLayout.GestureRecognizers>
                                <TapGestureRecognizer x:Name="NewStatus" NumberOfTapsRequired="1" Tapped="NewStatus_Tapped" />
                            </StackLayout.GestureRecognizers>
                        </StackLayout>
                    </DataTemplate>
                </CollectionView.ItemTemplate>
            </CollectionView>

and the UI looks like this

as you can see the image is squashed , i want to achieve this

Thanks

how to create a PDF from an image in Xamarin.forms

$
0
0

Hi,

Greetings!

Can some one tell me how to create a pdf from an image or screenshot of the Xamarin application?

I am having a billing page which I am taking a screenshot. But the same needs to be written into a new PDF..

Regards,
Mahesh B.

MTOUCH : error MT1303: Could not decompress the native framework

$
0
0

Hello,

After update in working solution Xamarin.Firebase.iOS.Core from 6.6.6 to 6.10.4 I can't build iOS projects anymore (downgrading to 6.6.6 fixes the problem). Locally and in Microsoft App Center (debug and release) I can see errors. Same problem appears in 2 different solutions but in 3rd I check everything seems to be fine.

LOCALLY:

start of central directory not found; | FingerReactionTestB.iOS | C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets | 885 |

Could not decompress the native framework 'FBLPromises.framework' from '/Users/Radek/Library/Caches/Xamarin/mtbs/builds/FingerReactionTestB.iOS/e9352cae321e5b371b3db15809ebd8f4/obj/iPhoneSimulator/Debug/mtouch-cache/FBLPromises.framework.zip'. Please review the build log for more information from the native 'unzip' command. | FingerReactionTestB.iOS | C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets | 885 |

APP CENTER:

_CompileToNative:
2020-11-09T12:25:30.6203030Z /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch @/Users/runner/work/1/s/TipCalculator/TipCalculator.iOS/obj/iPhone/Release/response-file.rsp --optimize=experimental-xforms-product-type "--gcc_flags=-ObjC -lc++ -lsqlite3 -lz -ObjC -lz -lsqlite3 -ObjC -lc++ -lsqlite3 -lz"
2020-11-09T12:25:31.4484760Z Xamarin.iOS 14.0.0.0 (xcode12): 7ec3751a1 using framework: /Applications/Xcode_12.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.1.sdk
2020-11-09T12:25:37.3224190Z Process exited with code 3, command:
2020-11-09T12:25:37.3226300Z /usr/bin/unzip System.String[]
2020-11-09T12:25:37.3294910Z MTOUCH : error [/Users/runner/work/1/s/TipCalculator/TipCalculator.iOS/obj/iPhone/Release/mtouch-cache/FBLPromises.framework.zip]: start of central directory not found; [/Users/runner/work/1/s/TipCalculator/TipCalculator.iOS/TipCalculator.iOS.csproj]
2020-11-09T12:25:37.3296540Z zipfile corrupt.
2020-11-09T12:25:37.3296900Z (please check that you have transferred or created the zipfile in the
2020-11-09T12:25:37.3297460Z appropriate BINARY mode and that you have compiled UnZip properly)
2020-11-09T12:25:37.3299010Z Archive: /Users/runner/work/1/s/TipCalculator/TipCalculator.iOS/obj/iPhone/Release/mtouch-cache/FBLPromises.framework.zip
2020-11-09T12:25:37.3299390Z
2020-11-09T12:25:40.2261310Z MTOUCH : error MT1303: Could not decompress the native framework 'FBLPromises.framework' from '/Users/runner/work/1/s/TipCalculator/TipCalculator.iOS/obj/iPhone/Release/mtouch-cache/FBLPromises.framework.zip'. Please review the build log for more information from the native 'unzip' command. [/Users/runner/work/1/s/TipCalculator/TipCalculator.iOS/TipCalculator.iOS.csproj]
2020-11-09T12:25:40.2263420Z
2020-11-09T12:25:40.4956100Z Done Building Project "/Users/runner/work/1/s/TipCalculator/TipCalculator.iOS/TipCalculator.iOS.csproj" (Rebuild target(s)) -- FAILED.
2020-11-09T12:25:40.5382030Z
2020-11-09T12:25:40.5385460Z Build FAILED.

When I checked problematic file (FBLPromises.framework.zip) in mtouch-cache folder it seems to be corrupted in both problematic solutions. Same file in solution without problem seems to be correct.

Cleaning and rebuilding solution didn't help.

Maybe anyone has an idea how to fix this error it?

Opening web page in browser using MSAL token

$
0
0

Hello,
Is it possible to open a web page from an app, like outlook365 or calendar, without re-authentication, as i already have a token via MSAL.
What is the best way to do this? interface?


Show a content loader while populating data from Api.

$
0
0


Hi All,
How can we make a this kind of loading content that we can show during populating data from api, kindly check the attachment.

Thanks.

Animation on xamarin forms using Lottie dont work!

$
0
0

Hi,
anyone use the Lottie nugget to play animations on xamarin forms.
I tested a simple example that dont run, just appear on android emulator a blank window.

I install the Lottie nugets.

Here is my xaml page:

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

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"

         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

         xmlns:forms="clr-namespace:Lottie.Forms;assembly=Lottie.Forms"

         x:Class="Example.Forms.MainPage">

    <forms:AnimationView 

            x:Name="AnimationView"

            Animation="LottieLogo1.json"

            Loop="True"

            AutoPlay="True"

            VerticalOptions="FillAndExpand"

            HorizontalOptions="FillAndExpand" />

I put the file "LottieLogo1.json" on Resources folder of the Droid Project.

Thanks

anyone having experience to run a .tflite model on Xamarin Android?

$
0
0

Needing healp to transfer a .tflite model and run on Xamarin Android locally, and create a custom bot framework around it.

Custom entry for OTP verification

$
0
0

How do I go about implementing a custom entry for OTP verification code in Xamarin Forms? The entry should show each digit separately with an underline, similar to the image below. I have seen some stackoverflow posts that suggest doing it with multiple chained entry boxes, but I doubt if that is the correct way to do it.

Entry cell loses focus on button press in android but not iOS , work around?

$
0
0

I have some code in iOS where I have buttons that act like a calculator keyboard when pressed on it fills a entry field that is focused.

Works great for iOS but on android the button press even causes the entry to lose focus. I have tried to set a custom renderer for buttons and focus to false however it doesn't fix the problem.

The reason I am using this method of custom number entry is because iOS and android doesn't have a decent numeric keyboard I need on all device types and sizes.

Can anyone give me a hint of a work around?

Viewing all 77050 articles
Browse latest View live


Latest Images

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