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

Flip image first then go to next page

$
0
0

Found here how to flip a image vertical

https://xamgirl.com/plug-and-play-animations-in-xamarin-forms/

That works , but when i put it on my phone you don't see the flip en go's to the next page immediately ( or to fast i don't see the flip)

Can i change it so i see the flip til it is done en go then to the next page ? Maybe with a delay of some kind or execute and then .....

<Image x:Name="Firebaseimage" Source="Firebase" WidthRequest="40" HeightRequest="40"> <Image.Behaviors> <behaviors:ViewTappedButtonBehavior Command="{Binding OnLoginCommand}" AnimationType="FlipVertical"/> </Image.Behaviors> </Image>

And the Tap part

void OnTapGestureRecognizerTapped(object sender, EventArgs args) { var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += async (s, e) => { // handle the tap await Navigation.PushAsync(new Page1()); }; Firebaseimage.GestureRecognizers.Add(tapGestureRecognizer); }


Scrollview scrolls over content above on Android.

$
0
0

Hi, do anyone know why a scrollview in a stacklayout scrolls out of it's box on android, no problem on IOS? Is there someway to solve this? Added a image to show the problem.

Different line heights in one label.

$
0
0

I have an issue with different line heights in one label, as you can see, there is problem with lines ending with \n. If the line isn't ended without \n, but with wordwrap, line spacing is much smaller.

Default back button on Android

$
0
0

Hi, I need to send a message (DisplayAlert or any kind of popup) if the user press the default button to go back to the previous page, How can I warm the user when that happen? because if he does that all of data in the current page will be lose it and a need to warn him about that. Any idea?

Xam.Plugin.Media -- Android is failing on 4.0.1.5

$
0
0

Android is failing on 4.0.1.5 with error:

'Unable to get file location. This most likely means that the file provider information is not set in your Android Manifest file. Please check documentation on how to set this up in your project.'

Source: https://github.com/jamesmontemagno/MediaPlugin#important-permission-information

What was done?

Manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.company.MyApp" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="MyApp"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.CAPTURE_SECURE_VIDEO_OUTPUT" />
<uses-permission android:name="android.permission.INSTALL_LOCATION_PROVIDER" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application>
    <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.company.MyApp.fileprovider" android:grantUriPermissions="true" android:exported="false">
        <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
    </provider>
</application>
</manifest>

Update in "MainActivity.cs" :

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

Update in "AssemblyInfo.cs" :

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

Added file "@xml/file_paths":

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-files-path name="my_images" path="Pictures" />
    <external-files-path name="my_movies" path="Movies" />
</paths>
  • NOTE -- If I set the added file to anything other than what was stated it is unable to find it. I was hoping EmbededResource would take care of it.

How to change backgroundcolor of actionbar

$
0
0

Hi guys!

I can't get my head around the following issue after reading a lot about this. My app has got an hamburger-menu and two additional buttons in the actionbar. The problem is (as you can see in the screenshot below) that the actionbar isn't taking the same (green-ish) backgroundcolor as the rest of the app.

From what I learned after several attempts and spending several hours of investigating this issue, is that I need to use a navigationpage as a mainpage in my App.xaml.cs. So I've done that;

public App()
        {
            InitializeComponent();

            if (IsLoggedIn())
            {
                //MainPage = new MainPage();
                MainPage = new NavigationPage(new MainPage());
                //MainPage = new NavigationPage(new MainPage()) { BarBackgroundColor = Color.FromHex("#55BBAB"), BarTextColor = Color.FromHex("#FFF") };                
            }
            else
            {
                //MainPage = new LoaderPage();
                MainPage = new SignIn();
            }
        }

After adding the line of code which instantiates the NavigationPage, I was suddenly stuck with two actionbars! I finally got this fixed by setting the option 'SetHasNavigationBar';

        public MainPage()
        {
            InitializeComponent();

            MasterBehavior = MasterBehavior.Popover;

            ////https://stackoverflow.com/questions/51824298/duplicate-xamarin-navbar-toolbar-items?rq=1           
            NavigationPage.SetHasNavigationBar(this, false);

            //MenuPages.Add((int)EMenuItemType.Browse, (NavigationPage)Detail);
        }

But whatever I try, I can't change the color of the actionbar / navigationbar. I tried suggestions similar to these;

But none of them seem to work. Is there anyone here who can help me out on this one? It's driving me nuts!

Xamarin Form: Best Practices for handling SignalR Core Client Connections

$
0
0

Hi all,

I would like to make some questions about the best practices of handling SignalR Core client inside to xamarin form application.
The resources found on the internet are limited to a chat functionality.
So my first question is:

  • Is good practice to create and connect to a hub through entire application cycle ?
    Some resources say no. So, you connect to a hub at OnAppearing method and you disconnect it at OnDisappearing method .
    So, let's say that a Page A connect to a hub at OnAppearing method, that page has a button that open a modal. That modal page needs the same hub too.
    And maybe inside the modal page has another button to open another modal that need the hub connection.
    So, as you can see, every time the same hub connection will be opened and closed.
    What is the best way to handle hub connections on these situations ? Or it doesn't cost too much resources so you shouldn't care?

Thanks in advance.
Regards

tap gesture recognizer tapped ItemTappedEventArgs not working

$
0
0

I have this error that the object is not referenced

And my TapGestureRecognizer is inside a Stacklayout and is inside a listview
in my XAML.

help me please.!!!


ProGuard Problem

$
0
0

Hello, I'm having a problem when generating the apk file. This happens when I activate the proGuard. What I've done so far:

  • Reinstalling the SDK files;
  • Downloading the latest proGuard and updating the folder;

What is weird is that in a new project I don't have this problem. But in the project I'm working I have this issue, so maybe is something related to the project and not the interface. I an still a newbie to Xamarin and C# and I'm learning on the go. I thought about recreating the project, but I don't now the proper way to do it. I know I probably didn't get the necessary info in the question but please let me know what information is required.

Thanks a lot.

How to enable Dotfuscator Community for Xamarin.Forms project?

$
0
0

Hello,

I want to obfuscate my code of my UWP/Android/iOS Xamarin.Forms project and I want to use the free Community Edition of Dotfuscator. I have installed Dotfuscator and Visual Studio 2019 and I found several different guides on how to use the Community and Professional Edition, I am especially unsure about whether or not to use the "PreEmptive.Dotfuscator.Xamarin.targets" files and different sources (from Preemptive and Microsoft) state different things.

Is there any up to date guide on how to enable Dotfuscator Community for Xamarin projects?

Thank you,
Philipp

How do you simply change the color/font of the items list of a Picker?

$
0
0

Hi Guys! We are almost to 2020 so I am sure someone has discovered a way of simply changing the color/font of a Picker's items list without using a renderer. Renderers are neat but after implementing one to simply change the text now my Xamarin functions of focus/unfocus are all ruined (for example on the first display of the items list the code makes me click "Cancel" twice to hide it).

So the question is, how to simply change the color/font of the items list of a Picker without using a Custom Renderer? Thanks!

App Specific Password question

$
0
0

Lately (with the newest VS for Mac), every time I publish an app to the app store/testflight, it asks me for my Apple ID and app specific password.
Fine I log in and go generate a password.
Then i enter it and submit the app, everybody happy...
...Until next time...every single time it asks me for the same apple id and specific password.

Of course i forgot to write it down and i have to generate a new one. How can i get it to save and stop asking?? Has anybody figured it out??

Thanks!

How to use DisplayAlert from a viewmodel without additional frameworks

$
0
0

I need to launch a DisplayAlert () from the body of a command in my viewmodel, how can I do this without using additional libraries?
I have the idea that it should be done with the MessagingCenter like all these kinds of things but I would like someone more experienced to confirm it and if possible, indicate the correct way to use it without causing loss of memory.

Certain FontAwesome fonts not displaying

$
0
0

I installed the latest font-awesome fonts into my xamarin.forms shared project (targeting Android only). I followed the instructions here:

https://www.wintellect.com/using-fontawesome5-xamarin-forms/

However, I notice that not all the fonts will display on my forms. E.g. fa-eye will display correctly, but fa-vial displays nothing. E.g.

<Label Text="&#xf492;" TextColor="Black" FontSize="Large">
  <Label.FontFamily>
    <OnPlatform x:TypeArguments="x:String" Android="fa-regular-400.ttf#Font Awesome 5 Free Regular" />
  </Label.FontFamily>
</Label>

The above example should display the fa-vial font icon, but nothing is shown. If I change the Text to &#xf06e then the fa-eye font icon is correctly displayed.

How to play Video using Plugin.MediaManager.Forms?

$
0
0

I am trying to play a video using Plugin.MediaManager.Forms and I am referring to this blog.

Step 1: Added Plugin.MediaManager and Plugin.MediaManager.Forms.

Step 2: XAML code - Added a VideoView

<?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:local="clr-namespace:VideoPlayerApp"  
             x:Class="VideoPlayerApp.MainPage"  
             xmlns:forms="clr-namespace:Plugin.MediaManager.Forms;assembly=Plugin.MediaManager.Forms"  
             Title="Video Player">  

    <ContentPage.Content>  
        <StackLayout>  

            <Label Text="Xamarin Forms"  
                   FontSize="40"  
                   TextColor="Azure"/>  
            <Label Text="Video Player Application"  
                   FontSize="58"  
                   TextColor="BlueViolet"/>  
            <Button x:Name="PlayStopButtonText"  
                    Text="Play"   
                    Clicked="PlayStopButton"  
                    TextColor="BlueViolet"/>  
            <forms:VideoView HeightRequest="202"  
                             WidthRequest="202"/>  
        </StackLayout>  
    </ContentPage.Content>
</ContentPage>   

Step 3: xaml.cs code

public partial class MainPage : ContentPage
    {
        private string videoUrl = "https://sec.ch9.ms/ch9/e68c/690eebb1-797a-40ef-a841-c63dded4e68c/Cognitive-Services-Emotion_high.mp4";
        public MainPage()
        {
            InitializeComponent();
        }

        private void PlayStopButton(object sender, EventArgs e)
        {
            if (PlayStopButtonText.Text == "Play")
            {
                CrossMediaManager.Current.Play(videoUrl, MediaFileType.Video);

                PlayStopButtonText.Text = "Stop";
            }
            else if (PlayStopButtonText.Text == "Stop")
            {
                CrossMediaManager.Current.Stop();

                PlayStopButtonText.Text = "Play";
            }
        }
    }

But getting error on this step:

Error CS0103 The name 'MediaFileType' does not exist in the current context

Step 4: Also added VideoViewRenderer.Init();in MainActivity.cs, AppDelegate.cs and MainPage.xaml.cs. But getting following error for this initialization.

The name 'VideoViewRenderer' does not exist in the current context

Am I missing something? I checked some other blogs but same error occuring. I have added a sample project here.


Xamarin.Forms CardsView nuget package

$
0
0

Hi all) I've released new package for Xamarin.Forms (Something like Tinder's CardsView)
Maybe, someone will be interested in it

nuget.org/packages/CardsView/ -- nuget
github.com/AndreiMisiukevich/CardView -- source and samples

System.NotImplementedException: 'This functionality is not implemented in the portable version of th

$
0
0

I have added Plugin.MediaManager and Plugin.MediaManager.Forms into my xamarin forms project for playing video.

CrossMediaManager.Current.Init(this);

when I am trying to add above code, it shows error (No overload for method Init();)

But getting below exception on android when running the project with below line of code.

CrossMediaManager.Current.Init();

System.NotImplementedException: 'This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.'

IOS and UWP apps are working fine, only android project has this issue. Please help me to fix this.

Stream Android Camera to Server in Xamarin Forms

$
0
0

I have to send my camera video stream frame by frame to a Web api and continously verify the response from web api. I have gone through many links over web and didnt found any good example for Xamarin forms. Only android native examples are available.
I am learner of Xamarin forms. Any sample or detailed steps would be more helpful. Thanks in advance..

Android : ImageLoaderSourceHandler: Could not retrieve image or image data was invalid: Uri:

$
0
0

I have always this problem to load image from url on Android device and simulator:
ImageLoaderSourceHandler: Could not retrieve image or image data was invalid: Uri:

for test i simply put :
Imag.Source = .....

but nothing happen....

I already tried all the combination for HttpClient and SSL/TLS in Android project settings

Do anyone know hot to solve this?

tks

bold string value issue

$
0
0

I have a string that contains ** instead of bold. I need to Bold these text by replacing **.

I need to bold only This and text words.

I found some example and tried. but not working.

these two not working

Viewing all 89864 articles
Browse latest View live


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