SlideShare a Scribd company logo
1 of 32
Download to read offline
XAMARIN FORMS
NOOB TO MASTER
By Rendy Del Rosario and Charlin Agramonte
Week 4
Objectives
- Understand what is a Control/Bindable properties and how to use it
- Understand what is a Custom Renderer
- Understand what is an Effect
Custom Renderers
What is a Custom Renderer?
Custom renderers provide a powerful approach for customizing the appearance
and behavior of Xamarin.Forms controls
Native Controls
Every Xamarin.Forms control has an accompanying renderer for each platform
that creates an instance of a native control.
Native Controls
Creating a Custom Renderer Step by Steps
1-Create a Xamarin.Forms custom control
2-Consume the custom control from Xamarin.Forms
3-Create the custom renderer for the control on each platform.
1-Create a Custom control
Can be created by subclassing the Control
2-Consume the custom control
- Add the nameSpace of your Control in your XAML, with a
variable (in this case Local)
- Use your variable with your Control Name
3-Create the custom renderer for the control on each
platform.
1- Subclass the platform renderer for the element on each platform
3-Create the custom renderer for the control on each
platform.
2- Override the OnElementChanged method that renders the native
control and write logic to customize the control. This method is called
when the corresponding Xamarin.Forms control is created.
3-Create the custom renderer for the control on each
platform.
3-Add an ExportRenderer attribute to the custom renderer class to
specify that it will be used to render the Xamarin.Forms control.
GROUP PRACTICE
Creating our first Custom Renderer
Renderer Good Pattern
Custom Properties
A bindable property is a special type of property, where the property's value is tracked by the
Xamarin.Forms property system.
INDIVIDUAL EXERCISE
Create a Custom Renderer for Underline a Label
TIME: 30 MINUTES
Effects
What is an Effect?
Effects allow the native controls on each platform to be customized, and are
typically used for small styling changes.
Why Use an Effect over a Custom Renderer?
Effects simplify the customization of a control, are reusable, and can be
parameterized to further increase reuse.
Creating an Effect Step by Steps
1-Create a subclass of the PlatformEffect class
2-Override the OnAttached method and write logic to customize the control
3-Override the OnDetached method and write logic to clean up the control
customization, if required.
4-Setting an effect identifier
5-Consum your effect
1-Create a subclass of the PlatformEffect class
2-Override the OnAttached method and write logic to
customize the control
OnAttached is called when the effect is added to a control
3-Override the OnDetached method and write logic
to clean up the control customization, if required.
OnDetached indicates the effect is being removed from the control, should reverse
any visual changes, remove event handlers, etc
Monitoring runtime changes
Effects can also monitor changes to the Xamarin.Forms Element by overriding the
OnElementPropertyChanged method
4-Add a ResolutionGroupName attribute to the effect
class.
5-Consume your effect
1- Declare a control that will be customized by the effect
2-Attach the effect to the control by adding it to the control's Effects
collection.
XAML
CODE BEHIND
GROUP PRACTICE
Creating our first Effect
Effect Parameters
A public class that subclasses the RoutingEffect class should be created to represent
effect parameters, as demonstrated in the following code example:
Creating
Consuming
INDIVIDUAL EXERCISE
Create an Effect for Underline a Label
TIME: 30 MINUTES
HOMEWORK PRACTICE
Basic Paint
Recommended Lectures
- Custom Renderers
- https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-rendere
r/
https://www.youtube.com/watch?v=55r1wHdOLBo
- Effects
https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/effects/creating/
https://www.youtube.com/watch?v=cFcwQhc1utg
By Rendy Del Rosario and Charlin Agramonte
Week 4
THANK YOU!!!

More Related Content

Similar to Xamarin Workshop Noob to Master – Week 4

Controllers and context programming
Controllers and context programmingControllers and context programming
Controllers and context programming
Kranthi Kumar
 
8.scope of the kaseya smart pilot
8.scope of the kaseya smart pilot8.scope of the kaseya smart pilot
8.scope of the kaseya smart pilot
kaseyaindia
 
scope of the kaseya smart pilot
scope of the kaseya smart pilotscope of the kaseya smart pilot
scope of the kaseya smart pilot
kaseyaindia
 

Similar to Xamarin Workshop Noob to Master – Week 4 (20)

Plugins And Making Your Own
Plugins And Making Your OwnPlugins And Making Your Own
Plugins And Making Your Own
 
Mastercam basics-tutorial
Mastercam basics-tutorialMastercam basics-tutorial
Mastercam basics-tutorial
 
Unveiling FME 2019
Unveiling FME 2019Unveiling FME 2019
Unveiling FME 2019
 
Connect 2014 AD209 - Making Your Development Team More Productive With IBM Do...
Connect 2014 AD209 - Making Your Development Team More Productive With IBM Do...Connect 2014 AD209 - Making Your Development Team More Productive With IBM Do...
Connect 2014 AD209 - Making Your Development Team More Productive With IBM Do...
 
Patch Management Software - Administrator Guide
Patch Management Software - Administrator Guide Patch Management Software - Administrator Guide
Patch Management Software - Administrator Guide
 
Magento Meetup New Delhi- Console
Magento Meetup New Delhi- ConsoleMagento Meetup New Delhi- Console
Magento Meetup New Delhi- Console
 
VMware App Volumes Troubleshooting
VMware App Volumes TroubleshootingVMware App Volumes Troubleshooting
VMware App Volumes Troubleshooting
 
Session on API auto scaling, monitoring and Log management
Session on API auto scaling, monitoring and Log managementSession on API auto scaling, monitoring and Log management
Session on API auto scaling, monitoring and Log management
 
Automation testing material by Durgasoft,hyderabad
Automation testing material by Durgasoft,hyderabadAutomation testing material by Durgasoft,hyderabad
Automation testing material by Durgasoft,hyderabad
 
Automation testing by Durgasoft in Hyderabad
Automation testing by Durgasoft in HyderabadAutomation testing by Durgasoft in Hyderabad
Automation testing by Durgasoft in Hyderabad
 
MY EASY CENTER FOR SYSTEM CENTER CONFIGURATION MANAGER
MY EASY CENTER FOR SYSTEM CENTER CONFIGURATION MANAGERMY EASY CENTER FOR SYSTEM CENTER CONFIGURATION MANAGER
MY EASY CENTER FOR SYSTEM CENTER CONFIGURATION MANAGER
 
Architecture: Manual vs. Automation
Architecture: Manual vs. AutomationArchitecture: Manual vs. Automation
Architecture: Manual vs. Automation
 
Controllers and context programming
Controllers and context programmingControllers and context programming
Controllers and context programming
 
What the hell is PowerShell?
What the hell is PowerShell?What the hell is PowerShell?
What the hell is PowerShell?
 
Level Up With Parallelism in FME Server
Level Up With Parallelism in FME ServerLevel Up With Parallelism in FME Server
Level Up With Parallelism in FME Server
 
8.scope of the kaseya smart pilot
8.scope of the kaseya smart pilot8.scope of the kaseya smart pilot
8.scope of the kaseya smart pilot
 
scope of the kaseya smart pilot
scope of the kaseya smart pilotscope of the kaseya smart pilot
scope of the kaseya smart pilot
 
Intro to Automation Using Perfecto's CQ Lab
Intro to Automation Using Perfecto's CQ LabIntro to Automation Using Perfecto's CQ Lab
Intro to Automation Using Perfecto's CQ Lab
 
SCCM 2019 Demo.pptx
SCCM 2019 Demo.pptxSCCM 2019 Demo.pptx
SCCM 2019 Demo.pptx
 
Diving Into Xamarin.Forms
Diving Into Xamarin.Forms Diving Into Xamarin.Forms
Diving Into Xamarin.Forms
 

More from Charlin Agramonte

More from Charlin Agramonte (20)

State machine in .NET
State machine in .NETState machine in .NET
State machine in .NET
 
Trabajando con máquinas de estados en.NET
Trabajando con máquinas de estados en.NETTrabajando con máquinas de estados en.NET
Trabajando con máquinas de estados en.NET
 
Improving the ux of our xamarin forms apps
Improving the ux of our xamarin forms appsImproving the ux of our xamarin forms apps
Improving the ux of our xamarin forms apps
 
Integrando un rest api con refit
Integrando un rest api con refitIntegrando un rest api con refit
Integrando un rest api con refit
 
Mejorando el UX de nuestras aplicaciones móviles en Xamarin Forms
Mejorando el UX de nuestras aplicaciones móviles en Xamarin FormsMejorando el UX de nuestras aplicaciones móviles en Xamarin Forms
Mejorando el UX de nuestras aplicaciones móviles en Xamarin Forms
 
Desenvolvendo Aplicações SOLID
Desenvolvendo Aplicações SOLIDDesenvolvendo Aplicações SOLID
Desenvolvendo Aplicações SOLID
 
Mastering XAML in Xamarin Forms
Mastering XAML in Xamarin Forms Mastering XAML in Xamarin Forms
Mastering XAML in Xamarin Forms
 
C# Good practices
C# Good practicesC# Good practices
C# Good practices
 
Starting my blog
Starting my blogStarting my blog
Starting my blog
 
C# Best Practices
C# Best PracticesC# Best Practices
C# Best Practices
 
Como prepararse y conseguir trabajo como Mobile Developer
Como prepararse y conseguir trabajo como Mobile DeveloperComo prepararse y conseguir trabajo como Mobile Developer
Como prepararse y conseguir trabajo como Mobile Developer
 
Desarrollando apps multi plataformas con xamarin forms
Desarrollando apps multi plataformas con xamarin formsDesarrollando apps multi plataformas con xamarin forms
Desarrollando apps multi plataformas con xamarin forms
 
C#good practices in 10 minutes
C#good practices in 10 minutesC#good practices in 10 minutes
C#good practices in 10 minutes
 
Xamarin Forms Best Practices
Xamarin Forms Best PracticesXamarin Forms Best Practices
Xamarin Forms Best Practices
 
Xamarin Forms Evolution
Xamarin Forms EvolutionXamarin Forms Evolution
Xamarin Forms Evolution
 
Why xamarin forms is awesome
Why xamarin forms is awesomeWhy xamarin forms is awesome
Why xamarin forms is awesome
 
Visual studio 2019 launch
Visual studio 2019 launch Visual studio 2019 launch
Visual studio 2019 launch
 
Prism in xamarin forms from zero to hero
Prism in xamarin forms from zero to hero Prism in xamarin forms from zero to hero
Prism in xamarin forms from zero to hero
 
Xamarin forms - overcloud
Xamarin forms - overcloudXamarin forms - overcloud
Xamarin forms - overcloud
 
Xamarin forms from zero to hero
Xamarin forms from zero to heroXamarin forms from zero to hero
Xamarin forms from zero to hero
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Xamarin Workshop Noob to Master – Week 4

  • 1. XAMARIN FORMS NOOB TO MASTER By Rendy Del Rosario and Charlin Agramonte Week 4
  • 2. Objectives - Understand what is a Control/Bindable properties and how to use it - Understand what is a Custom Renderer - Understand what is an Effect
  • 4. What is a Custom Renderer? Custom renderers provide a powerful approach for customizing the appearance and behavior of Xamarin.Forms controls
  • 5. Native Controls Every Xamarin.Forms control has an accompanying renderer for each platform that creates an instance of a native control.
  • 7. Creating a Custom Renderer Step by Steps 1-Create a Xamarin.Forms custom control 2-Consume the custom control from Xamarin.Forms 3-Create the custom renderer for the control on each platform.
  • 8. 1-Create a Custom control Can be created by subclassing the Control
  • 9. 2-Consume the custom control - Add the nameSpace of your Control in your XAML, with a variable (in this case Local) - Use your variable with your Control Name
  • 10. 3-Create the custom renderer for the control on each platform. 1- Subclass the platform renderer for the element on each platform
  • 11. 3-Create the custom renderer for the control on each platform. 2- Override the OnElementChanged method that renders the native control and write logic to customize the control. This method is called when the corresponding Xamarin.Forms control is created.
  • 12. 3-Create the custom renderer for the control on each platform. 3-Add an ExportRenderer attribute to the custom renderer class to specify that it will be used to render the Xamarin.Forms control.
  • 13. GROUP PRACTICE Creating our first Custom Renderer
  • 15. Custom Properties A bindable property is a special type of property, where the property's value is tracked by the Xamarin.Forms property system.
  • 16. INDIVIDUAL EXERCISE Create a Custom Renderer for Underline a Label TIME: 30 MINUTES
  • 18. What is an Effect? Effects allow the native controls on each platform to be customized, and are typically used for small styling changes.
  • 19. Why Use an Effect over a Custom Renderer? Effects simplify the customization of a control, are reusable, and can be parameterized to further increase reuse.
  • 20. Creating an Effect Step by Steps 1-Create a subclass of the PlatformEffect class 2-Override the OnAttached method and write logic to customize the control 3-Override the OnDetached method and write logic to clean up the control customization, if required. 4-Setting an effect identifier 5-Consum your effect
  • 21. 1-Create a subclass of the PlatformEffect class
  • 22. 2-Override the OnAttached method and write logic to customize the control OnAttached is called when the effect is added to a control
  • 23. 3-Override the OnDetached method and write logic to clean up the control customization, if required. OnDetached indicates the effect is being removed from the control, should reverse any visual changes, remove event handlers, etc
  • 24. Monitoring runtime changes Effects can also monitor changes to the Xamarin.Forms Element by overriding the OnElementPropertyChanged method
  • 25. 4-Add a ResolutionGroupName attribute to the effect class.
  • 26. 5-Consume your effect 1- Declare a control that will be customized by the effect 2-Attach the effect to the control by adding it to the control's Effects collection. XAML CODE BEHIND
  • 28. Effect Parameters A public class that subclasses the RoutingEffect class should be created to represent effect parameters, as demonstrated in the following code example: Creating Consuming
  • 29. INDIVIDUAL EXERCISE Create an Effect for Underline a Label TIME: 30 MINUTES
  • 31. Recommended Lectures - Custom Renderers - https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-rendere r/ https://www.youtube.com/watch?v=55r1wHdOLBo - Effects https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/effects/creating/ https://www.youtube.com/watch?v=cFcwQhc1utg
  • 32. By Rendy Del Rosario and Charlin Agramonte Week 4 THANK YOU!!!