Xamarin.Forms 4.0 CollectionView Pull-To-Refresh - xamarin

I'm trying out the pre-release CollectionView control for Xamarin.Forms 4.0 and I've run into a small hickup.
I've ben able to get binding, styling, etc. working perfectly, but I'm unable to figure out how to implement Pull-To-Refresh. This is in the shared code project and final product targets iOS and Android only.
I've been over Microsoft's documentation and haven't been able to find a clear solution for this.
The only reference I've seen to anything remotely related to this issue comes from a GitHub discussion on the XF page (Xamarin.Forms.CollectionView Spec Discussion) where they mention that the IsPUllToRefreshEnabled functionality has been moved from the ListView API to a new RefreshView control.
Can anyone shine any light on this issue and if this is even possible to implement? (Data for collection view is fed by Refit API call)

The RefreshView is still in spec, not yet implemented (see the Github page)
However, from the comments, you can try and use PullToRefresh Nuget, that allows pull to refresh on a scrollview or a listview.

Related

Are there any visual differences between WKWebView and UIWebView?

I wanted to migrate away from the deprecated UIWebView in Xamarin Forms iOS, and I read online that WKWebView is now the default in Xamarin Forms 4.x, and I was currently in 3.6.0.x.
So I decided to update hoping that the Webview would automatically update for me, but I realized there is no way to tell because I don't know what, and if there even is a difference in how the webviews look. I've looked online but can't find any side by side pictures of the same app/interface using WK vs. UI. Is there a difference at all?
The only difference I saw after updating, was that on one of the pages, the loading icon wouldn't disappear whereas it did after a couple of seconds in UI.
Thanks!
Welcome to StackOverflow! :)
The easiest way to answer this question is simply going to be to test it. To my knowledge, both UIWebView and WKWebView use the exact same underlying WebKit code/engine to render HTML content. There may be differences due to separate defaults and properties that one has vs. the other, but for the most part, they should be identical. But you shouldn't take my word for it! If you can, give it a try.

How do you mix Xamarin.Forms with Xamarin.Native using MvvmCross?

According to MvvmCross 5.3 documentation you can mix Xamarin.Forms and Xamarin.Native:
"With MvvmCross 5.3, you will now be able to mix and match Native Xamarin views with Xamarin.Forms pages using ViewModel navigation!"
My scenario is the solution contains Xamarin.Android and Xamarin.iOS projects which rely quite heavily on MvvmCross. Going forward I would like to be able to create new views/pages using Xamarin.Forms. I'm assuming this is what is meant by "mix and match".
Other than the above statement I can't find any documentation or examples on how to do this.
I tried extending the MvvmCross TipCal app to show a new Xamarin.Forms view/page without any luck.
Can someone explain or provide an example of how to mix and match Xamarin.Forms with Native Xamarin using MvvmCross?
I think if you truly want to mix forms/native you need to either create a custom view presenter or trick the existing view presenter to "embed" a forms page into a viewcontroller/fragment/activity.
I have created a helper library as a proof of concept to embed Xamarin.Forms content pages into fragments/activities/viewControllers but could use some help ironing out some bugs with Android. It seems to work fine for iOS.
Let's take iOS as an example.
This approach has you create you content page as normal, but also create a wrapper viewController. You embed the content page in the viewController and when you navigate, you navigate to the viewController wrapper instead of the content page.
https://github.com/dornerworks/Mvx.Forms.PageWrapper.iOS
https://github.com/dornerworks/Mvx.Forms.PageWrapper.Android

Is something like Prism INavigationAware Interface for ViewModels in Xamarin.Forms 4 AppShell Navigation?

In Prism for Xamarin.Forms there is an interface INavigationAware. You implement it in the ViewModels (if you want to). There are three methods, OnNavigatedFrom, OnNavigatedTo and OnNavigatingTo. These methods are called by the Prism navigation framework. You can load data, do some logging or cancel the navigation operation.
Now I am using the new Shell Navigation (AppShell) in Xamarin.Forms 4.1 without Prism. Is there something equivalent or similar available with Shell Navigation? Is there an adviced pattern to, for example, load some data from a database when the user navigates to the page or to cancel Navigation Operation?
Edit: I understand Prism does not support Shell Navigation at the moment. What I ask, is to do something similar without Prism.
As was provided above. This question has previously been answered. https://stackoverflow.com/a/56793314/4984832
Xamarin.Forms Shell is not currently supported. It is a planned feature in Prism 7.3 and won't start until sometime after some changes from the Xamarin.Forms team are available in an official build. The issue can be tracked here: https://github.com/PrismLibrary/Prism/issues/1809

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.

Xamarin forms iOS default mail app Behavior

As per the requirement of the project I need to have the page which should behave as the default Apple Mail app on the iPhone.
Attaching a gif that I have created for the same.
I tried using the plug in https://github.com/rotorgames/Rg.Plugins.Popup
but I couldn't achieve the exact same behavior where the background shrinks and expands as the modal pop up is dragged.Any leads, examples or demos will be really helpful.
Note: I am using Xamarin.Forms.
With the new Xamain Forms update. i.e. after iOS13
The model behavior has became the default model behavior for Xamarin iOS.
When you do.
Navigation.PushModalAsyn(<your_page_here>).
It gives the above (gif) behavior.

Resources