How to implement listView item with longPress event - xamarin

I need a ListView with long pressed event handler.
When listviewItem is longpressed, an popup should appear for example.
Does anyone knows, if this is possible with xamarin.forms MVVM?
Thanks

There is a known issue about this in xamarin forms, you can check it here: [Enhancement] LongPressGestureRecognizer.
And just as this remark mentioned :
this will probably be in .NET MAUI but won't make it into
Xamarin.Forms anymore. If needed check out the Xamarin Community
Toolkit or other relevant libraries
But there are several workarounds:
You can refer to article: Longpress Event For Image In Xamarin.Forms.
And you can also check thread : How to make long press gesture in Xamarin Forms?

Related

Customise bottom Navigation using xamarin forms c#

I need to design bottom navigation bar like I attached image using xamarin.forms common code for both android and IOS. Can anybody refer any link or library tool to do this?
You should check the xamarin community toolkit, this is certainly possible to create with the tabview.
https://learn.microsoft.com/en-us/xamarin/community-toolkit/views/tabview

Carousel Page not appearing in Xamarin.Forms template

I am trying to add new Carousel Page in my Xamarin.Forms application but on doing Add new item it's not appearing in the template list.
I am using Visual Studio 15.9 Preview.
Carousel Page not appearing in Xamarin.Forms template
With the release of Xamarin.Forms 2.2.0, we now have the CarouselView, a replacement for the CarouselPage. CarouselPage will be marked as deprecated in a future release. That's why the CarouselPage template been removed. You could find it in the Xamarin.Forms release notes.
Also, you could see the talk Jason Smith gave at Evolve where he specifically says that you should not use CarouselPage and you use use CarouselView instead: https://youtu.be/RZvdql3Ev0E
CarouselView
CarouselView is intended to fully replace CarouselPage. CarouselPage
will be deprecated in a future release. CarouselView is superior in
many ways, including its ability to be virtualized and nested within
layouts.
As SushiHangover has pointed out:
Xamarin.Forms CarouselPage does not support UI virtualization (recycling).
Initialization performance and memory usage can be a problem depending upon the number of pages/children.
Benefits of CarouselView:
Can now be embedded in a page (big bonus)
Is virtualized
Suggestion 1:
If you want use CarouselPage in your project, you need write it on you own:
Xamarin.Forms Carousel Page
CarouselPage sample
Suggestion 2:
Using CarouselView instead:
Flip through items with Xamarin.Forms CarouselView
https://xamarinhelp.com/carousel-view-xamarin-forms/
You have to write it out yourself. Xamarin Forms can do many things and has made cross-platform development much easier, but you still have to do some of the work yourself!
More info on CarouselPage.

Events for native controls in Xamarin Forms?

I just checked out consuming native UI iOS/Android controls in Xamarin Forms. One thing I don't understand is what events to specify as triggering an update for bindings. The article mentions UISwitch as an example and specifies the ValueChanged event for triggering updating bindings. But where can I find information about which events can be used for other iOS and Android controls?
As an example I tried UITextView and couldn't find any info on which events is being supported in the official docs. Some experimenting and I found I could use an event called "Changed", but there has to be some docs somewhere for this I guess. Antone know where?
iOS uses the delegate pattern heavily. UITextView uses the UITextViewDelegate - in native iOS you would provide your own delegate that is responsible for responding to events raised by the control

Bind/set short text data from Android MainActivity.cs to a shared Xamarin Forms Label?

Is there a way to define a Label in Xamarin Forms (XAML or code-behind) AppXYZ that can be updated from the Xamarin Android AppXYZ.Android: MainActivity.cs and AppXYZ.iOS:Main.cs? i.e. upon an event in Android (e.g. BlueTooth) set a short text in a common Forms elements? After viewing many example, no clarity yet. MessageCenter perhaps?
In Android Project: MainActivity.cs (for example):
FormsAppXYZ.LabelXYZ.Text = "Updated string";
If not possible, then proper way to do this with Xamarin Android Native ? appreciated since I'll have to mix in the label into a shared Xamarin Forms Tabbed GUI.
Depending on how much Bluetooth work you need to do, my first suggestion would be to use MessagingCenter as you have already alluded to.
The other obvious approach would be to use a third party plugin, as I don't believe Xamarin have released one. I am currently aware of these two:
https://github.com/aritchie/bluetoothle
https://github.com/xabre/xamarin-bluetooth-le

Xamarin pop up with default close button in Xamarin form pcl

Can anyone suggest a best method to show pop up with close button by default in Xamarin forms with animations. To be more specific, if we are clicking on a card, it should come from the location of tap or click.
I have used xlabs for the same. Is there any other packages that I can use?
Could you share a sample code if possible?

Resources