Xamarin.Forms ExportRenderer vs ExportCell - xamarin.forms

I am trying to get better understanding of Xamarin.Forms renderers. I know what they are. They create a native view based on input from Xamarin Forms. You put in a Xamarin Forms ViewCell, and you get back a Android View or iOS UITableViewCell, or Windows DataTemplate. I get that.
But I have seen code using ExportRenderer and other code using ExportCell and I dont know what is the difference. When to use one over the other?
Xamarin documentation/page search is not finding either one.
They usage is identical:
[assembly: ExportRenderer(typeof(MyXamarinFormsElementType), typeof(MyNativeRendererType))]
[assembly: ExportCell(typeof(MyXamarinFormsElementType), typeof(MyNativeRendererType))]
In fact, in my code, I have a ListView with ItemCellRenderer and I tried adding either of these two assembly attributes and there is no visible difference.
As I said, Xamarin API provides zero information on this.

Related

Daydream keyboard implementation

I am attempting to implement the Daydream keyboard into an app built in Unity and am not able to get this to work. I have added the keyboard prefab as a sibling of the main camera and added two input fields with the onpointerclick function added as instructed. I however get a null reference exception and assume this is due to the daydream keyboard delegate field being blank. The example scene in the SDK shows the daydream delegate example prefab but I am unsure how to implement this for two input fields. Also does the keyboard render in the Unity editor or must it be built and run on a phone?
This is an old question and has probably already been answered, but I figured I'd publicize my answer anyway.
For those reading, if you haven't checked out the Keyboard Demo scene that can be found within the Demos folder of the Google VR Unity package, I would highly recommend doing so. Following this object hierarchy has worked for me in the past.
To answer your first question, it seems that they have included a KeyboardDelegateExample object within the scene's hierarchy, and then used this object as the Keyboard Delegate in the GVRKeyboardManager.
They manage to fake an Input Field by creating a background and overlaying a Text object on top. If this method does not suffice and using an Input Field is crucial in your particular case, then drop your Input Fields into two separate GVRKeyboardCanvas objects.
Clicking on either canvas will activate the GVR Keyboard. You may have to add a small script to manage the transitioning of the input field.
Lastly, no the GVR Keyboard does not render in the Unity Editor, it only appears while running a build. Hopefully this will be addressed in later releases. There are also Keyboard plugins that you may find useful on the Asset Store.

Custom Renderers in Xamarin.Forms Class Library

How do I create a platform-specific custom renderer within a Xamarin.Forms class library?
I'm creating a Xamarin Forms class library that allows me to expand a picker's list with a tap anywhere on the control. That means I need to open the picker's list programmatically within the control's Tapped event handler.
This is trivial in the Android and iOS picker implementations - just a call to the picker's .Focus() method. However, the .Focus() method of the UWP's picker doesn't respond the same way - mainly because UWP must also handle mouse events, not just touch events.
Conceptually no problem, though, since I should be able to create a custom renderer for UWP to set the combobox's .DropDown property within the Tapped even handler.
Except...I'm not sure how to create a platform-specific custom renderer within a class library, since - unlike a normal Xamarin.Forms project - there are no platform-specific projects in which to implement custom renderers. Unfortunately, I haven't been able to find information anywhere about how to do this.

Xamarin.Forms Toolbar Animation with Android Design Support Library

i want realize a page like the one below, using xamarin.forms mixing up some renderers.
This is a pure Android example, and it works fine http://blog.iamsuleiman.com/toolbar-animation-with-android-design-support-library/
but how to achieve it with .forms?
As shown in the example code, the page is composed by a
CoordinatorLayout
. AppBarLayout
.. CollapsingToolbarLayout
... ImageView (etc...)
. RecycleView --> It should be fine use the .forms listview here, but how?
If you insist on forms project and not native I would go by inserting complete native page into xamarin forms project. You can find more info how to create a renderer for native page in forms: https://blog.xamarin.com/customize-your-xamarin-forms-app-with-pages-for-each-platform/

Does ReactiveUI for Xamarin supports ViewModel to ViewModel Navigation

I am in process of learning Reactive UI for Xamarin and going through the documentation. However was not able to find that does it supports ViewModel to ViewModel Navigation. Is there any example application for same.
At the moment navigation support for Xamarin forms is somewhat limited. So is is not possible to select if a Page should be Pushed Modal or not.
After trying to use RxUI nagivation I surrendered and now use RxUI together with xamvvm framework to deal with Page/ViewModel creation and ViewModel based navigation.
Check it out https://github.com/xamvvm/xamvvm/wiki
Please have a look at this issue: https://github.com/reactiveui/ReactiveUI/issues/1048 There are ways to do it but you'll have to implement it yourself.
You can do it natively by following approach described here https://blog.kloud.com.au/2018/05/15/data-first-approach-in-xamarin-forms/

How can I get MVVM Light to work nicely with a Grouped Items Page in Metro?

I am trying to implement a Metro style Grouped Items Page using the MVVM Light framework following the sample in this blog post but using a ViewModelLocator to provide blendability:
http://mikaelkoskinen.net/post/winrt-tutorial-mvvm-gridview-semanticzoom.aspx
I have got this working, unfortunately the grid itself is not showing up in the designer (which is the point of me using MVVM Light). I have bound the title without problem so I know that the viewmodel is bound correctly.
Any ideas please?
I had the same problem. The issue is, if you're using a CollectionViewSource, that it needs to be explicitly, like this:
As MVVM Light injects design-time-services into the viewmodel you'd expect this to pick up your service and push the design-time data through your viewmodel to the UI. But it doesn't.
You need to give it an explicit design-time instance for this to work:
There is a useful article about using CollectionViewSource in design mode that may help.

Resources