SlideShare a Scribd company logo
#MonkeyConf
Xamarin
Community
Toolkit
Javier Suarez
@jsuarezruiz
Gerald Versluis
@jfversluis
SPONSORS
Xamarin Community Toolkit
The Xamarin Community Toolkit is a collection of common elements for mobile
development with Xamarin.Forms that people tend to replicate across multiple apps. It
simplifies and demonstrates common developer tasks when building apps with
Xamarin.Forms.
The library contains:
• Behaviors
• Converters
• Effects
• Views
#MonkeyConf
Behaviors
Behaviors
Behaviors lets you add functionality to user interface controls without having to subclass them. Behaviors are
written in code and added to controls in XAML or code.
• EmailValidationBehavior
• EventToCommandBehavior
• NumericValidationBehavior
• AnimationBehavior
• MaskedBehavior
• UriValidationBehavior
• RequiredStringValidationBehavior
• UserStoppedTypingBehavior
• ImpliedOrderGridBehavior
• MaxLengthReachedBehavior
• CharactersValidationBehavior
Behaviors
#MonkeyConf
DEMO: Let's
take a look at
the behaviors
#MonkeyConf
Converters
Converters
Suppose you want to define a data binding where the source property is of type int but the target property is
a bool. You want this data binding to produce a false value when the integer source is equal to 0,
and true otherwise.
You can do this with a class that implements the IValueConverter creating something you probably know,
Converters.
In the XCT, we try to group those common Converters, which are repeated from app to app to simplify the process.
• ByteArrayToImageSourceConverter
• DateTimeOffsetConverter
• ItemSelectedEventArgsConverter
• ItemTappedEventArgsConverter
• MultiConverter
#MonkeyConf
DEMO: Let's
take a look at
the converters
#MonkeyConf
Effects
Effects
Effects allow the native controls on each platform to be customized, and are typically used for small styling
changes.
Available Effects:
• IconTintColorEffect
• RemoveBorderEffect
• SafeAreaEffect
• SelectAllTextEffect
Effects
#MonkeyConf
DEMO: Let's
take a look at
the effects
#MonkeyConf
Views
AvatarView
<xct:AvatarView
ColorTheme="{x:Static xct:ColorTheme.Jungle}"
FontSize="Medium”>
<xct:AvatarView.Source>
<UriImageSource Uri="{Binding Source}" />
</xct:AvatarView.Source>
</xct:AvatarView>
The AvatarView represents a user's name by using the initials and a generated
background color.
BadgeView
<xct:BadgeView
BackgroundColor="Red"
TextColor="White"
Text="1">
<Label
Text="BadgeView"/>
</xct:BadgeView>
View used to used to notify users notifications, or status of something.
GravatarImageSource
<Image>
<Image.Source>
<xct:GravatarImageSource
Email="{Binding Email}"
Size="{Binding Size}"
CachingEnabled="{Binding EnableCache}" />
</Image.Source>
</Image>
The GravatarImageSource allows you to easily utilize a users Gravatar image from
Gravatar.com using nothing but their email address.
Expander
<xct:Expander IsEnabled="{Binding IsEnabled}">
<xct:Expander.Header>
<Label Text="Nested expander" FontSize="30"
FontAttributes="Bold"/>
</xct:Expander.Header>
<xct:Expander.ContentTemplate>
<DataTemplate>
<StackLayout Spacing="0" Margin="10" Padding="1"
BackgroundColor="Black">
<BoxView HeightRequest="50" Color="White" />
<BoxView HeightRequest="50" Color="Red" />
<BoxView HeightRequest="50" Color="White" />
</StackLayout>
</DataTemplate>
</xct:Expander.ContentTemplate>
</xct:Expander>
The Expander control provides an expandable container to host any content.
MediaElement
<xct:MediaElement
x:Name="mediaElement"
Source="https://sec.ch9.ms/ch9/5d93/a1eab4bf-3288-4faf-81c4-
294402a85d93/XamarinShow_mid.mp4"
ShowsPlaybackControls="True"
MediaOpened="OnMediaOpened"
MediaFailed="OnMediaFailed"
MediaEnded="OnMediaEnded"
SeekCompleted="OnSeekCompleted" />
MediaElement is a view for playing video and audio.
RangeSlider
<xct:RangeSlider
x:Name="RangeSlider"
MaximumValue="10"
MinimumValue="-10"
StepValue="0.01"
LowerValue="-10"
UpperValue="10”>
<xct:RangeSlider.LowerThumbView>
<Label Text="L" VerticalTextAlignment="Center"
HorizontalTextAlignment="Center" IsVisible="{Binding IsToggled,
Source={x:Reference LowerThumbViewSwitch}}" />
</xct:RangeSlider.LowerThumbView>
<xct:RangeSlider.UpperThumbView>
<Label Text="U" VerticalTextAlignment="Center"
HorizontalTextAlignment="Center" IsVisible="{Binding IsToggled,
Source={x:Reference UpperThumbViewSwitch}}" />
</xct:RangeSlider.UpperThumbView>
</xct:RangeSlider>
The RangeSlider is a slider with two thumbs allowing to select numeric ranges.
SnackBar
var messageOptions = new MessageOptions
{
Message = GenerateLongText(5)
};
var actionOptions = new List<SnackBarActionOptions>
{
new SnackBarActionOptions
{
Text = "Action1",
Action = () =>
{
Debug.WriteLine("1");
return Task.CompletedTask;
}
},
new SnackBarActionOptions
{
Text = "Action2",
Action = () =>
{
Debug.WriteLine("2");
return Task.CompletedTask;
}
}
};
var options = new SnackBarOptions
{
MessageOptions = messageOptions,
Duration = TimeSpan.FromMilliseconds(5000),
Actions = actionOptions
};
var result = await this.DisplaySnackBarAsync(options);
Show SnackBar, Toast etc.
StateLayout
<xct:StateLayout.StateViews>
<xct:StateView StateKey="Loading" BackgroundColor="White"
VerticalOptions="FillAndExpand">
<StackLayout VerticalOptions="Center"
HorizontalOptions="Center">
<ActivityIndicator Color="#1abc9c" IsRunning="{Binding
MainState, Converter={StaticResource StateToBooleanConverter},
ConverterParameter={x:Static xct:LayoutState.Loading}}" />
<Label Text="Loading..." HorizontalOptions="Center" />
</StackLayout>
</xct:StateView>
</xct:StateLayout.StateViews>
A collection of attached properties that let you specify one or more state views for any of
your existing layouts.
SideMenuView
<xct:SideMenuView x:Name="SideMenuView">
<!-- MainView -->
<StackLayout
Orientation="Horizontal"
BackgroundColor="Gold">
<Button Style="{StaticResource BaseMenuButtonStyle}"
Clicked="OnLeftButtonClicked" />
<Button Style="{StaticResource BaseMenuButtonStyle}"
HorizontalOptions="EndAndExpand"
Clicked="OnRightButtonClicked" />
</StackLayout>
<!-- LeftMenu -->
<BoxView
BackgroundColor="Orange"
xct:SideMenuView.Position="LeftMenu"
xct:SideMenuView.MenuWidthPercentage=".5" />
<!-- RightMenu -->
<BoxView
BackgroundColor="LightGreen"
xct:SideMenuView.Position="RightMenu"
xct:SideMenuView.MenuWidthPercentage=".3" />
</xct:SideMenuView>
SideMenuView is a simple and flexible Right/Left menu control.
Shield
<xct:Shield
Subject="IDE"
Status="2019"
Color="DodgerBlue"
TextColor="White"
Margin="2,0" />
Shields can show some status information or call-to-action in a badge-like way.
TabView
<xct:TabView
TabStripPlacement="Bottom"
TabStripBackgroundColor="Blue"
TabStripHeight="60"
TabIndicatorColor="Yellow"
TabContentBackgroundColor="Yellow">
<xct:TabViewItem
Icon="triangle.png"
Text="Tab 1"
TextColor="White"
TextColorSelected="Yellow"
FontSize="12">
<Grid
BackgroundColor="Gray">
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
Text="TabContent1" />
</Grid>
</xct:TabViewItem>
<xct:TabViewItem
Icon="circle.png"
Text="Tab 2"
TextColor="White"
TextColorSelected="Yellow"
FontSize="12">
<Grid>
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
Text="TabContent2" />
</Grid>
</xct:TabViewItem>
</xct:TabView>
Shields can show some status information or call-to-action in a badge-like way.
#MonkeyConf
DEMO: Let's
take a look at
the controls
¿How to use the XCT?
The toolkit is available via NuGet, and should be installed into all your projects:
The Xamarin Comunity Toolkit also include C# markup.
C# markup is an opt-in set of fluent helper methods and classes to simplify the process of
building declarative Xamarin.Forms user interfaces in C#. The fluent API provided by C#
markup is available in the Xamarin.CommunityToolkit.Markup NuGet package.
Install-Package Xamarin.CommunityToolkit -Version 1.0.0-pre5
Install-Package Xamarin.CommunityToolkit.Markup -Version 1.0.0-pre5
C# Markup
C# markup is an opt-in set of fluent helper methods and classes to simplify the process of building declarative
Xamarin.Forms user interfaces in C#.
View Build() => new Grid
{
RowDefinitions = Rows.Define(
(BodyRow.Prompt , 170 ),
(BodyRow.CodeHeader, 75 ),
(BodyRow.CodeEntry , Auto),
(BodyRow.Button , Auto)
),
ColumnDefinitions = Columns.Define(
(BodyCol.FieldLabel , 160 ),
(BodyCol.FieldValidation, Star)
),
Children =
{
new Label { LineBreakMode = LineBreakMode.WordWrap } .Font (15) .Bold ()
.Row (BodyRow.Prompt) .ColumnSpan (All<BodyCol>()) .FillExpandHorizontal () .CenterVertical () .Margin (fieldNameMargin) .TextCenterHorizontal ()
.Bind (nameof(vm.RegistrationPrompt)),
new Label { Text = "Registration code" } .Bold ()
.Row (BodyRow.CodeHeader) .Column(BodyCol.FieldLabel) .Bottom () .Margin (fieldNameMargin),
new Label { } .Italic ()
.Row (BodyRow.CodeHeader) .Column (BodyCol.FieldValidation) .Right () .Bottom () .Margin (fieldNameMargin)
.Bind (nameof(vm.RegistrationCodeValidationMessage)),
new Entry { Placeholder = "E.g. 123456", Keyboard = Keyboard.Numeric, BackgroundColor = Color.AliceBlue, TextColor = Color.Black } .Font (15)
.Row (BodyRow.CodeEntry) .ColumnSpan (All<BodyCol>()) .Margin (fieldMargin) .Height (44)
.Bind (nameof(vm.RegistrationCode), BindingMode.TwoWay),
new Button { Text = "Verify" } .Style (FilledButton)
.Row (BodyRow.Button) .ColumnSpan (All<BodyCol>()) .FillExpandHorizontal () .Margin (PageMarginSize)
.Bind (Button.IsVisibleProperty, nameof(vm.CanVerifyRegistrationCode))
.Bind (nameof(vm.VerifyRegistrationCodeCommand)),
}
};
#MonkeyConf
What's next?
What's next?
• Popups!
• ContentButton
• Layouts like:
• UniformGrid
• HexLayout
• DockLayout
An much more!
#MonkeyConf
Let’s see how
to
collaborate
with the XCT
Thanks to the
Community!
#monkeyconf
Questions?
Thanks!
Gracias a nuestros Sponsors.
Sin ellos el evento no sería posible.

More Related Content

PPTX
Cape Town MS Developer User Group: Xamarin Community Toolkit
PPTX
Xamarin.Android Introduction
PPTX
Xamarin Dev Days Madrid 2017 - Xamarin.Forms
PPT
Introdução ao Microsoft Silverlight 2.0 - Campus Party Brasil 2009
PDF
Get the Most out of Android 8 Oreo with Visual Studio Tools for Xamarin
PDF
Diving Into Xamarin.Forms
PDF
Customizing Xamarin.Forms UI
PDF
Rails MVC by Sergiy Koshovyi
Cape Town MS Developer User Group: Xamarin Community Toolkit
Xamarin.Android Introduction
Xamarin Dev Days Madrid 2017 - Xamarin.Forms
Introdução ao Microsoft Silverlight 2.0 - Campus Party Brasil 2009
Get the Most out of Android 8 Oreo with Visual Studio Tools for Xamarin
Diving Into Xamarin.Forms
Customizing Xamarin.Forms UI
Rails MVC by Sergiy Koshovyi

What's hot (20)

PPT
Presentation wpf
PDF
Intro to Xamarin.Forms for Visual Studio 2017
PDF
Appcelerator Titanium Kinetic practices part 1
PPS
WPF (Windows Presentation Foundation Unit 01)
PDF
Wpf Introduction
PDF
What Web Developers Need to Know to Develop Windows 8 Apps
PDF
20130528 solution linux_frousseau_nopain_webdev
PDF
Build Better Games with Unity and Microsoft Azure
PPTX
Building xamarin.forms apps with prism and mvvm
PDF
Spring Day | WaveMaker - Spring Roo - SpringSource Tool Suite: Choosing the R...
PDF
SkiaSharp Graphics for Xamarin.Forms
PDF
Desktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
PPT
WordPress development paradigms, idiosyncrasies and other big words
PDF
Wordcamp abq cf-cpt
PPTX
Better User Experience with .NET
PDF
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
PPTX
Using Components to Build Native-Quality HTML5 Apps
PPTX
Wpug mvvm and data binding
PDF
CIRCUIT 2015 - Content API's For AEM Sites
PDF
Cross-platform mobile apps with Apache Cordova
Presentation wpf
Intro to Xamarin.Forms for Visual Studio 2017
Appcelerator Titanium Kinetic practices part 1
WPF (Windows Presentation Foundation Unit 01)
Wpf Introduction
What Web Developers Need to Know to Develop Windows 8 Apps
20130528 solution linux_frousseau_nopain_webdev
Build Better Games with Unity and Microsoft Azure
Building xamarin.forms apps with prism and mvvm
Spring Day | WaveMaker - Spring Roo - SpringSource Tool Suite: Choosing the R...
SkiaSharp Graphics for Xamarin.Forms
Desktop Developer’s Guide to Mobile with Visual Studio Tools for Xamarin
WordPress development paradigms, idiosyncrasies and other big words
Wordcamp abq cf-cpt
Better User Experience with .NET
WordCamp ABQ 2013: Making the leap from Designer to Designer/Developer
Using Components to Build Native-Quality HTML5 Apps
Wpug mvvm and data binding
CIRCUIT 2015 - Content API's For AEM Sites
Cross-platform mobile apps with Apache Cordova
Ad

Similar to Monkey Conf 2020: Xamarin Community Toolkit: More possibilities with Xamarin.Forms! (20)

PPTX
Xamarin.Forms or Write Once, Run Anywhere
PDF
From Backbone to Ember and Back(bone) Again
PPTX
Sviluppare applicazioni cross-platform con Xamarin Forms e il framework Prism...
PPTX
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
PPTX
MongoDB.local Atlanta: Introduction to Serverless MongoDB
PPTX
.NET Fest 2017. Matteo Pagani. Prism and Xamarin Forms: create cross-platform...
PDF
What's new in Xamarin.Forms?
PDF
When Smalltalk Meets the Web
PDF
Vector Graphics in Xamarin
PPTX
Stunning Mobile Apps with the Xamarin Visual Design System​
PDF
AtlasCamp 2013: Confluence patterns
PPTX
Building strong foundations apex enterprise patterns
PPTX
Canvas in html5
PPTX
Intro to .NET for Government Developers
PPTX
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
PPTX
Modern ASP.NET Webskills
PPTX
extending-and-optimizing-xamarin-forms-apps
PPTX
Java script
PDF
WebNet Conference 2012 - Designing complex applications using html5 and knock...
PPTX
Connecting Xamarin Apps with IBM Worklight in Bluemix
 
Xamarin.Forms or Write Once, Run Anywhere
From Backbone to Ember and Back(bone) Again
Sviluppare applicazioni cross-platform con Xamarin Forms e il framework Prism...
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
MongoDB.local Atlanta: Introduction to Serverless MongoDB
.NET Fest 2017. Matteo Pagani. Prism and Xamarin Forms: create cross-platform...
What's new in Xamarin.Forms?
When Smalltalk Meets the Web
Vector Graphics in Xamarin
Stunning Mobile Apps with the Xamarin Visual Design System​
AtlasCamp 2013: Confluence patterns
Building strong foundations apex enterprise patterns
Canvas in html5
Intro to .NET for Government Developers
C# everywhere - Building Cross-Platform Apps with Xamarin and MvvmCross
Modern ASP.NET Webskills
extending-and-optimizing-xamarin-forms-apps
Java script
WebNet Conference 2012 - Designing complex applications using html5 and knock...
Connecting Xamarin Apps with IBM Worklight in Bluemix
 
Ad

More from Javier Suárez Ruiz (20)

PPTX
DotNetDom: El futuro de Xamarin
PPTX
Tech Club Asturias: Un vistazo al presente y futuro de Xamarin.Forms
PPTX
Monkey Conf 2020: .NET MAUI Handlers
PPTX
Creando controles para Xamarin.Forms
PPTX
Monkey Conf 2019: Presente y futuro de Xamarin.Forms
PPTX
Crear interfaces de usuario atractivas con Xamarin.Forms
PPTX
#XamarinUIJuly Summary
PPTX
DotNet 2019: Optimizando Apps con Xamarin.Forms
PPTX
Taller Xamarin Monkey Conf 2018
PPTX
Monkey Conf 2018: Conociendo Xamarin.Forms Shell
PPTX
.Net Conf Sevilla 2018
PPTX
Analizando interfaces de usuario avanzadas con Xamarin.Forms
PPTX
OpenSouthCode 2018: Taller Xamarin
PPTX
DotNet2018: Xamarin.Forms Everywhere!
PPTX
Novedades Xamarin 3.0 Preview
PPTX
Desarrollo Xamarin, más allá del desarrollo
PPTX
Introducción a Xamarin.Forms
PPTX
Introducción a Xamarin
PPTX
Aumento de productividad, herramientas Xamarin
PPTX
Plain Concepts Tech Day: Desarrollo de aplicaciones multiplataforma con Xamarin
DotNetDom: El futuro de Xamarin
Tech Club Asturias: Un vistazo al presente y futuro de Xamarin.Forms
Monkey Conf 2020: .NET MAUI Handlers
Creando controles para Xamarin.Forms
Monkey Conf 2019: Presente y futuro de Xamarin.Forms
Crear interfaces de usuario atractivas con Xamarin.Forms
#XamarinUIJuly Summary
DotNet 2019: Optimizando Apps con Xamarin.Forms
Taller Xamarin Monkey Conf 2018
Monkey Conf 2018: Conociendo Xamarin.Forms Shell
.Net Conf Sevilla 2018
Analizando interfaces de usuario avanzadas con Xamarin.Forms
OpenSouthCode 2018: Taller Xamarin
DotNet2018: Xamarin.Forms Everywhere!
Novedades Xamarin 3.0 Preview
Desarrollo Xamarin, más allá del desarrollo
Introducción a Xamarin.Forms
Introducción a Xamarin
Aumento de productividad, herramientas Xamarin
Plain Concepts Tech Day: Desarrollo de aplicaciones multiplataforma con Xamarin

Recently uploaded (20)

PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PPTX
Chapter 5: Probability Theory and Statistics
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
The various Industrial Revolutions .pptx
PPT
What is a Computer? Input Devices /output devices
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Developing a website for English-speaking practice to English as a foreign la...
PPTX
Tartificialntelligence_presentation.pptx
PPTX
observCloud-Native Containerability and monitoring.pptx
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Web App vs Mobile App What Should You Build First.pdf
PPTX
1. Introduction to Computer Programming.pptx
Zenith AI: Advanced Artificial Intelligence
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Hindi spoken digit analysis for native and non-native speakers
DP Operators-handbook-extract for the Mautical Institute
Enhancing emotion recognition model for a student engagement use case through...
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
A contest of sentiment analysis: k-nearest neighbor versus neural network
Chapter 5: Probability Theory and Statistics
cloud_computing_Infrastucture_as_cloud_p
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
The various Industrial Revolutions .pptx
What is a Computer? Input Devices /output devices
Univ-Connecticut-ChatGPT-Presentaion.pdf
Group 1 Presentation -Planning and Decision Making .pptx
Developing a website for English-speaking practice to English as a foreign la...
Tartificialntelligence_presentation.pptx
observCloud-Native Containerability and monitoring.pptx
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Web App vs Mobile App What Should You Build First.pdf
1. Introduction to Computer Programming.pptx

Monkey Conf 2020: Xamarin Community Toolkit: More possibilities with Xamarin.Forms!