Xamarin.Forms excels at quickly producing cross-platform mobile experiences that look and feel at home on the host platforms. But how do you make sure your app experience is also consistent with your brand experience? Now with Xamarin.Forms Visual you can adopt a singular look and feel across your native applications, and even share that experience across multiple applications. Whether you want Material Design everywhere, or you want to craft your own, in this session you'll learn how to build a Visual implementation, consume it in your app(s), and distribute it. Visual is the next step forward in creating beautiful, native UI with Xamarin. To top it off we will look at the next generation of productivity tools for Xamarin developers to help them create stunning apps.
31. Visual
• Sets of renderers
• Adhering to a specific design system
• Beginning with Material Design
• ActivityIndicator
• Button
• Editor
• Entry
• Frame
• Picker
• ProgressBar
• Slider
• Stepper
32. Visual – The Renderer Process
Forms.Init
Registers Button
renderers by type
and visual marker
new
ContentPage()
App parses UI
graph which asks
for a Button
Looks up
renderer by
type & visual
Fallback is default
renderer
Creates
detached
instance
Populates
properties
Attaches
to visual
tree
38. “By supporting one UI we can move faster than our
competition.”
“Our company supports many apps, so sharing more
code means less burden of support.”
39. “By supporting one UI we can move faster than our
competition.”
“Our company supports many apps, so sharing more
code means less burden of support.”
“To get approved by the regulatory body (FDA).”
40.
41.
42.
43. A design system is a series of
components that can be reused in
different combinations. Design
systems allow you to manage
design at scale.
https://www.forumone.com/ideas/what-is-design-system/
Material Design
• Material is a
44. Designers wishing to give their suite
of products a unique but
consistent look and feel define a
design language for it, which can
describe choices for design aspects
such as materials, colour schemes,
shapes, patterns, textures, or
layouts.
https://en.wikipedia.org/wiki/Design_language
Material Design
• Material is a
45. Designers wishing to give their suite
of products a unique but
consistent look and feel define a
design language for it, which can
describe choices for design aspects
such as materials, colour schemes,
shapes, patterns, textures, or
layouts.
https://en.wikipedia.org/wiki/Design_language
Material Design
• Material is a
63. Material Visual
namespace Xamarin.Forms
{
public static class FormsMaterial
{
public static void Init(Context context, Bundle bundle)
{
// my only purpose is to exist so when called
// this dll doesn't get removed
VisualMarker.RegisterMaterial();
}
}
}
77. Thank you.
James
Montemagno
Principal Program Manager – Mobile Developer Tools,
Microsoft
motz@microsoft.com Montemagno.com @JamesMontemagno
Weekly development podcast
mergeconflict.fm
Weekly development show
xamarinshow.com
Notas del editor
As developers we need to be able to reach every platform on the planet. And that is the goal of .NET enabling developers to build for these devices with unique frameworks optimized for each.
Today, we will look at what the Xamarin platform and framework, which are part of .NET offer.
So, let’s start with exactly what Xamarin is.
In fact there are tons of companies that entrust Xamarin and .NET today.
These companies leverage Xamarin and .NET across all verticals and all different types of platforms.
First, it is with it’s unique application architecture. In fact it is the .NET architecture itself. You decided what platforms you want your apps to run on, we call them head projects.
You can access all of the native APIs for each and share a bulk of the C# logic. Here we see business logic, platform APIs, and user interfaces. This can scale to a lot or a little based on what you are trying to achieve. So how exactly does this work?
First is the core architecture which enables huge amount of code sharing across apps. You can build stunning applications with high fidelity. Let’s talk about what is in each of these blocks, first with the head projects, platform APIs, and user interface. The business logic is just .NET code that can always be shared with other .NET platforms.
The first part in the head projects is access to any of the unique APIs in iOS and Android. You have access to them all in C#. Now, these do have to be written in the head project and aren’t shared since they are unique to each platform. However, the Xamarin team has a way to help us out there.
Which is Xamarin.Essentials. An open source library that abstracts common native features into a single cross platform API for iOS, Android, and Windows. These are APIs that exist across each platform so why not bring them together.
So now, if we look a bit further, this is what our app architecture looks like.
What about the user interface? Just like APIs you can build the native UI for each platform. However, many developers choose to share all or most of the UI with Xamarin.Forms
Miguel
We will look more at Xamarin.Forms, but now we can see a full picture of what goes into our app.
What Material provides, how it works
What’s next for Material
Properties for styling
What additional controls are needed/desired
What Visual is by itself
## Objects
1. Forms VisualElement
2. Platform Renderer
## How a Button makes it to the screen:
1. Forms.Init - registers Button renderers by type (Button) and visual (Default|Material)
2. App parses UI graph, get's ContentPage with a Button
3. Looks up renderer by type & visual
4. Creates detached renderer instance
5. Populates properties
6. Attaches to visual tree
Where does measuring and layout happen? In the above?
When does the below happen, before or after the UI is attached to the visual tree?
## Invalidation
1. InvalidateMeasure Called
2. Call InvalidateMeasure on Parent
3. Has Parent?
a. Yes Return to 2.
b. No. Continue.
4. Queue Delay layout
## Layout
5. Event callback triggers layout (What event?)
6. Layout Called
7. LayoutChildren Invoked
8. Has Children?
a. Yes. Return to 6.
b. No. Continue.
9. Layout Cycle Completed
What Material provides, how it works
What’s next for Material
Properties for styling
What additional controls are needed/desired
What Material provides, how it works
What’s next for Material
Properties for styling
What additional controls are needed/desired
What Material provides, how it works
What’s next for Material
Properties for styling
What additional controls are needed/desired
What Material provides, how it works
What’s next for Material
Properties for styling
What additional controls are needed/desired
In each platform project to ensure the dll isn’t linked out.