Recycle Fragment Views when using ViewPager (Mvvmcross) - xamarin

I am using a ViewPager in an Mvvmcross Android App. The Fragments inside the ViewPager are all of the same kind. Is there a possibility to use some view recycling to avoid inflating a new view when scrolling through the ViewPager?

Related

Xamarin Forms Custom Page Renderer Data Bindings

I'm developing a Xamarin Forms application and I have implemented an IOS custom renderer for a content page.
I generate the page from laying out the native controls programmatically where ListEntry is a subclass of UITextField.
ListEntry entry = new ListEntry(control, new CGRect(x, y, width, height));
entry.BackgroundColor = UIColor.Blue;
view.AddSubview(entry);
I have been using two way data binding to hook up my Xamarin Form content pages to view models but I'm not sure how I go about doing this with custom renderers and native controls. I'm looking for a little guidance on the best way to approach this?
Thanks

How to request REDRAW from Xamarin.forms' side SkiaSharp?

I'm making app with using Xamarin.forms.
I'm drawing 2d view with using SkiaSharp.
I'm able to use SetNeedDisplay on iOS pcl side to make animation.
But I want to call it from Forms pcl.
Is there any method like that?
SkiaSharp Views for Xamarin.Forms provides the InvalidateSurface() for this particular reason:
https://developer.xamarin.com/api/member/SkiaSharp.Views.Forms.SKCanvasView.InvalidateSurface()/
and
https://developer.xamarin.com/api/member/SkiaSharp.Views.Forms.SKGLView.InvalidateSurface()/

Create custom Tabbar in Xamarin Forms using NaviagtionPages & Buttons added inside a ContentPage

I want to create custom Tabbar in Xamarin Forms using NaviagtionPages & Buttons added inside a ContentPage.
I cannot use the default Tabbed Page because the UI shows up differently for Android and iOS with it (tabbar at top on android vs tabbar at bottom for iOS).
Hence, I was creating a common component using Xamarin forms.
I have created a similar custom tabbar in iOS (by adding Navigation controllers as child controllers along with buttons in a View controller).
So far I have added Buttons and ContentPages(by ContentPage.Content) inside a ContentPage. I toggle the visibility of the content pages on tapped events of the buttons.
But I want to replace the ContentPages by NavigationPages so that each tab(button) can have its own stack of ContentPages.
Unfortunately, I cannot figure out how to add NavigationPage inside a content view to make this work.

CoreAnimation layer causes WebView to not redraw properly

In a project I have been working on I wanted to use CoreAnimation layers to improve tableview rendering, however when i turned on Core Animation for certain layers it caused issues with my WebView.
https://github.com/jozefdransfield/TestWebView demonstrates a WebView inside a view displaying a large image. Which reproduces the issue I am seeing.
If View has Core Animation Layer checked then the WebView does not draw the image properly if you scroll within the webView, with it uncheck the webView behaves as expected.
Has anyone seen this issue before and have an idea how to fix/work around it. Or can you simply not mix webviews with CALayers?

OSX Cocoa embed opengl view inside webview

I am trying to build an MacOS app which create an OpenGL view and embed it to webview as it's element (using OpenGL instead of WebGL). The main goal is to use the web (html/javascript) as UI and draw the result with OpenGL view. (besides, the OpenGL view will also handle the user input)
The issue is the overlay between the webview and OpenGL view. If OpenGL view on top of webview, the webview UI (like: dropdown box) possible cut by the OpenGL view. The webview on top of OpenGL view, all of the webview view will block the OpenGL view.
Is there any solution to solve this? (OpenGL and Webview)
WebKit has an interesting functionality where you can associate webviews with certain MIME types to your own custom NSView classes.
In your HTML webview, you can put an iframe which has a custom mimetype (e.g. "application/my-custom-view").
After that, from your native app, you can call:
[WebView registerViewClass:[MyCustomView class] representationClass:[MyCustomRepresentation class] forMIMEType:#"application/my-custom-view"];
See https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Webkit/Classes/WebView_Class/Reference/Reference.html#//apple_ref/occ/clm/WebView/registerViewClass:representationClass:forMIMEType:
MyCustomRepresentation can be pretty lightweight, my Representation class doesn't do anything, it just defines stub delegate functions.

Resources