Xamarin Forms Iphone 5s. Custom Picker to custom Editor - xamarin

I have a problem only in iphone 5s. When the focus change from custom control inherited from Picker to one inherited from Editor, the keyboard hide the Editor.

I found a solution. Just use the following code:
void Handle_Focused(object sender, Xamarin.Forms.FocusEventArgs e)
{
ScrollStack.ScrollToAsync(labelQuestion, Xamarin.Forms.ScrollToPosition.Start, true);
}

Related

What is the preferred way of interacting with Lottie files in a .NET MAUI app?

I would like to implement an animated Play/Pause button in my .NET MAUI streaming app.
For this I thought I might use a lottie file.
I am able to use SkiaSharp.Extended.UI.Maui to load and animate a lottie file.
However, the control itself does not offer any kind of interaction such as Commands or an OnClick event handler.
Maybe I am blind, but what is the preferred way of transforming this "static" control to something, my users can interact with?
If you want to provide some interactions, i thought you could add some gestures on SKLottieView.
In .xaml file
<skia:SKLottieView
x:Name="myanimatedview"
Source="dotnetbot.json"
HeightRequest="300"
WidthRequest="300"
RepeatCount="-1">
<skia:SKLottieView.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
</skia:SKLottieView.GestureRecognizers>
</skia:SKLottieView>
In .cs file, implement the event handler.
void TapGestureRecognizer_Tapped(System.Object sender, System.EventArgs e)
{
Console.WriteLine("hello"); // do whatever you want here
myanimatedview.IsAnimationEnabled = !myanimatedview.IsAnimationEnabled;
}
You could add different gestures, such as pinch, pan, swipe etc, to interact with users. For more information, you could refer to Xamarin.Forms gestures.
Hope it works for you.

Xamarin forms UWP AppViewBackButtonVisibility.Collapsed doesn't seem to work

I'm using Xamarin Forms 3.6.
I want to hide the back button in the UWP app.
In the UWP App.xaml.cs OnLaunced I've added.
SystemNavigationManager
.GetForCurrentView()
.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
I've also added it to each ContentPage (using dependency injection) so that in the constructor of each page runs the above code.
Each content page, I've also added:
NavigationPage.SetHasNavigationBar(this, false);
I always still seem to get the back button in the title bar on UWP.
Any ideas in Xamarin Forms UWP how to hide and keep hidden the back button?
For your requirement, please invoke SetHasBackButton static method in the page where you want to hide back button like the following.
public ItemDetailPage(ItemDetailViewModel viewModel)
{
InitializeComponent();
NavigationPage.SetHasBackButton(this, false);
BindingContext = this.viewModel = viewModel;
}

Xamarin NavigationBar back button click

I am developing a xamarin forms application in which I need to intercept the navigation bar back button. I could do this in android by the
OnOptionsItemSelected method in the activity.
How can I do this in iOS platform? Please help me.
In the XAML Page you can set the has back button to false:
<ContentPage
NavigationPage.HasBackButton="False"
Title="MyPage">
</ContentPage>
And for Android device,you need to disable the physical back button function:
protected override bool OnBackButtonPressed()
{
//return base.OnBackButtonPressed();
return true;
}

Xamarin Form Navigation Bar Color to be changed in Windows platform

I am using a Portable Xamarin form solution to create an Application that will work in IOS, Android and Windows.We are facing a problem in setting the background color of the Navigation Bar. BarBackground color is not working so We tried to change the colors in each Platform but couldn't do it in Windows.
Thanks in Advance.
You are using Xamarin.forms. So, change the constructor of App.Xaml.cs in your PCL.
public App()
{
MainPage = new NavigationPage(new Page1())
{
BarBackgroundColor = Color.Gray
};
}

Back button PhoneGap Windows Phone 7

While certifiying my Phonegap App for Windows Phone 7 I was told that the back-button doesn't work the way it should. My application only has one page, so here it's not a problem but it is possible to display a menu using javascript.
When this menu is open, the back-button is supposed to close the menu instead of exiting the application. Does anyone have an idea on how I could easily catch the event of a click on the back-button in order to check if the menu is open and then close it or completely exit the application if it isn't?
I tried document.addEventListener("backbutton", onBackKeyDown, false); but apparently this does not work for Windows Phone 7!
Thanks a lot
WP7 PhoneGap definitely supports the back button. You can download a working example from my blog here:
http://www.scottlogic.co.uk/blog/colin/2011/11/handling-the-back-stack-in-windows-phone-7-phonegap-applications/
Make sure you handle the deviceready event first.
Why don't you use the native Silverlight.
XMAL
BackKeyPress="PageBackKeyPress"
Code-Behind
private void PageBackKeyPress(object sender, CancelEventArgs e)
{
// DO NOT CLOSE
if (Something)
e.Cancel = true;
}
I have the same problem. When you write
document.addEventListener("backbutton", onBackKeyDown, false);
That will block the the default backbutton handler. So you may need to do so tricks in the phonegap code. It's not the best way, but it's quite easy though. Check out this one:
http://blog.projectdebug.com/?p=6

Resources