Effects vs Behaviors vs Renderers - xamarin

I'm newbie in Xamarin forms. In xamarin documentation, it seems all effects, behaviors and Renderers give same functionality of modifying native controls. please brief me when exactly we can use each of them to achieve different functionality

BEHAVIOR: Behaviors allow you to enhance the functionality of a Xamarin Forms control without sub classing. Using the Behaviors property you can add behaviors that attached to the Control and can execute code when events of that control are raised. don't need a separate implementation for each platform
EFFECTS: use only when you need a small styling change for any control. Effects need a seperate implementation for each platform.
RENDERER: if you want a customized control for your project create a renderer with native implementation. Renderer need to implemented for each platform

Related

What is the main diff b/w Custom Renderer and Effects in Xamarin Forms? How to create them?

How to create Custom Renderer and effects in Xamarin Forms and how to decide when should i use which one?
Better use a custom renderer if you need to override methods of a platform-specific control (e.g. add buttons onto the native DatePicker control).
Or else, you can use effects for simple customizations of a platform-specific control (e.g. remove borders for all entries).
Quoted from the MS documentation :
Effects simplify the customization of a control, are reusable, and can be parameterized to further increase reuse.
Anything that can be achieved with an effect can also be achieved with a custom renderer. However, custom renderers offer more flexibility and customization than effects.

How to create same UI as given UX in xamarin forms?

I am working in xamarin forms. I have some UX given by the designer. Now I want to create exactly same UI(same height of control, width of control, colors etc) in xamarin forms. My xaml view should be exactly xame like given UX.
Is there any tool that can guide me to create same UI like UX. I mean through that tool I can get the height, widths and colors of controls of screens and then can use it.
it's not good idea to use exact length of UI since the app will run on different screen and different devices. Xamarin forms uses native views for each platform which will also change the look of basic views.
What you need to do is to use grids or other layouts for sizing and control the height and the width of your views.
I also suggested that you always use scroll view incase if a mobile has a small screen size.
Finally, regarding the actual UI components and UX interactions, there are many ready components like calendars, custom checkboxes, sliders,... . If you can't find a component that cover what you need, you have 2 options:
combine different components and try to customize them with absolute
and Relative layouts.
Create the components yourself which will require some knowledge
on each platform to create the view component by drawing it and do
all the handling for each platform.
Regarding the UX, there are many libraries for animations and most components allow customizability.
Your question was very general so this answer is general. Please try to be more specific next time.

Xamarin - mixing Forms and Storyboards

Is it possible to mix iOS Storyboards and Xamarin Forms within one application? I have a bunch of views that are easier to be created in Forms, but some which are heavily customized so we would need to create some of them in native code.
I would like to use Storyboards to create the native parts, but can't seem to find a way to navigate from a Forms page to a Storyboard and vice versa.
I don't mind doing it from code, just need to know the direction to look into and if it's even possible.
You can create native views using the concept of Custom Renderers (see links below). The idea is that you create a Xamarin Forms Control that's shared between all platforms and which old common properties (like colors, general data etc), and do the native rendering on the iOS/Android/WP projects.
So, for your storyboard, you can create it usign Xamarin.iOS, and render using a Custom Renderer. The link posted by #GSerg in the comments have some information and examples, but you can take a closer look at the oficial documentation as well:
Introduction to Custom Renderers
Customizing Controls on Each Platform
Customizing Control Rendering in Xamarin.Forms (video)
Also, for more real world examples you can take a look at the Xamarin Forms XLabs project.
Thanks to Rafael Steil's answer. I looked at the links and a few more samples.
Notably:
Custom Renderer Map
Using Xamarin Forms alongside Storyboard
And I created a sample project to show the back-and-forth navigation between Xamarin Forms and pages created in Storyboards. You can find it over here:
Xamarin Forms Mixed with Native

Same UI for all platforms in Mvvmcross Xamarin

Hello All, Can i code one UI for all platforms using Mvvm Cross framework in Xamarin?
Like i code for a generic UI which can generated for different platforms Android,IOS,Windows.
I saw Xamarin Forms giving some thing like this , but what about MVVMCross.
So if i conclude in simple sencario , since xamarin forms uses Mvvm so its better to use xamarin forms instead of mvvmcross for one single Ui
No, Mvvmcross doesn't provide UI automagically. View is platform specific while models and viewmodels are platform independent.
With Forms all three are platform independent. To make this work Forms added another layer, called Renderer (which is platform specific). Out of the box there is a bunch of renderers, then there is 3rd party community (specially Forms Labs) and finally, you can make your own renderers or extend existing ones.

Custom Painted Controls

We need to automate GUI testing of an application developed in Win32 API. Developer's have created this application by custom painted controls. They have controls which look like Grid, Buttons etc., but they are not basic Windows controls.
What is custom painted controls? and how we can test these controls?
Test it just like any other UI: Not at all. Move all code out of the callbacks into the application layer where your unit tests can execute them just like any other method.
Rationale: There is little point in testing whether "button.activate()" works; you want to know whether the your code behind the button callback works.
If you need to know whether the correct dialogs, etc., are opened, see my blog: Testing the Impossible: User Dialogs
Have the developers added support for accessibility using IAccessible? If they have, you can use active accessibility to navigate through the controls and test them that way.
If they haven't, open a bug that says that their controls can't be use by disabled people (who need a screen reader or other accessibility aid).
Once they fix that bug, you can use whatever mechanism they added to their controls to allow them to be used by screen readers and other accessibility aids to test their UI.

Resources