SlideShare a Scribd company logo
Getting hands on with
XAML and
Xamarin.Forms
Mitch “Rez” Muenster
@MobileRez
mobilerez.tumbler.com
Xamarin Certified Developer
What is this about?
 Using Xamarin.Forms
 Working with XAML Syntax & Behavior
 Using Advanced XAML
 Doing more then just a Tech talk but letting you code
Using Xamarin.Forms
What is Xamarin.Forms?
 Xamarin.Forms is a software framework that lets you build
one app with UI and behavior and deploy it to each of the
mobile platforms
Understanding Xamarin.Forms UI
 Xamarin.Forms UI is defined in 4 different ways; Pages,
Layouts, Cells, and Views.
What is a Page?
 A page is used to define a single screen that contains most or all of the screen.
What is a Layout?
 A layout is a special type of view that acts as a container for other views or
layouts.
What is a View?
 A View is the term Xamarin.Forms uses for all its basic controls from Buttons to
Progress Bars.
 Some of the Views Xamarin.Forms contains are
 Button
 Date Picker
 Entry (input box)
 Label
 Picker (The phones form of dropdown list)
 Progress Bar
A full list of Views at https://developer.xamarin.com/guides/cross-platform/xamarin-forms/controls/views/
What is a Cell?
 A Cell is a special element that is used inside tables and defines how each item
in a list is rendered.
 An example of Cells Xamarin.Forms supports:
 Entry Cell
 Switch Cell
 Text Cell
 Image Cell
A full list of Cells at https://developer.xamarin.com/guides/cross-platform/xamarin-forms/controls/cells/
Traditional way to build Forms apps
 Xamarin.Forms apps are commonly built using all using C# and not XAML.
 A new Xamarin.Forms app is usually created with a dummy app in a cs file
public App()
{
// The root page of your application
MainPage = new ContentPage {
Content = new StackLayout {
VerticalOptions = LayoutOptions.Center,
Children = {
new Label {
XAlign = TextAlignment.Center,
Text = "Welcome to Xamarin Forms!“
}
}
}
};
}
Working with XAML Syntax &
Behavior
What is XAML?
 XAML stands for Extensible Application Markup Language
and was created by Microsoft specifically for working with
the UI
 A XAML file is always associated with a C# code file.
Why use XAML over all code in a .cs
file?
 Designer can create UI while coder focuses on code in the
code file
 XAML allows for features like DataBinding Animations,
Custom behaviors, value converters & more.
 Easier to work with for those who like to have a more visual
representation of their layouts
 Helps keep a separation between UI and app logic
Building a layout in XAML
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Toolbox.View.Page1">
<StackLayout>
<StackLayout.Padding>
<OnPlatform x:TypeArguments="Thickness“
iOS="0, 20, 0, 0"/>
</StackLayout.Padding>
<Label Text="{Binding MainText}" VerticalOptions="Center" HorizontalOptions="Center" />
</StackLayout>
</ContentPage>
XAML Syntax: Attached properties & Property Elements
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Toolbox.View.MunitConverter“>
<StackLayout VerticalOptions="CenterAndExpand" Padding="20" >
<Grid HorizontalOptions="Center" >
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
...
<Label x:Name="endLabel" Grid.Row="7" StyleId="EndLabel" XAlign="Center"/>
</Grid>
</StackLayout>
</ContentPage>
Platform Targeted Tweaks
 Building a cross platform app means you may need to tweak a specific
platform or device class (phone or tablet) to make it match the other
platforms. To do this we can use OnPlatform and OnIdiom
OnPlatform & OnIdiom
 OnPlatform allows us to define code for a specific platform
 OnIdiom allows us to define code for either a tablet or phone
 Both are useful for providing those quick tweaks to get the UI to look the
same on all devices or only changing one platform to fit the rest of their
needs
 Can be used with padding, color, size, font, width, height, and strings/text
OnPlatform & OnIdiom In Action
 OnPlatform is used here to add a thickness at the top of the app on iOS to
make room for the top menu. OnIdiom Is used to set a color based on the
platform.
<StackLayout>
<StackLayout.Padding>
<OnPlatform x:TypeArguments="Thickness“
Android="0, 0, 0, 0“
iOS="0, 20, 0, 0“
WinPhone="0, 0, 0, 0"/>
</StackLayout.Padding>
<StackLayout.BackgroundColor>
<OnIdiom x:TypeArguments="Color“
Phone="Teal“
Tablet="Green"/>
</StackLayout.BackgroundColor>
<Label Text="{Binding MainText}" VerticalOptions="Center" HorizontalOptions="Center" />
</StackLayout>
Advanced XAML
Reducing Duplicated styles with XAML
 When defining multiple and app wide styles, we run into the issue of needing
to get the most out of our code and limit reuse or duplication of similar styles.
In XAML we can do this with Resource Dictionaries.
Resource Dictionary's
 A Resource Dictionary Is a dictionary that can be defined in the XAML or code
behind and is used to hold UI resources such as colors, fonts, and styles.
 A resource in the Dictionary Uses the x:Key to define the ID of that resource so
you can reference it later.
Using a Resource Dictionary
<ContentPage.Resources>
<ResourceDictionary>
<Color x:Key="TxtRed">Red</Color>
<OnPlatform x:Key="TxtColor“ x:TypeArguments="Color“ Android="Green“ iOS="Teal“
WinPhone="Purple"/>
<LayoutOptions x:Key="HorzCenter">Center</LayoutOptions>
</ResourceDictionary>
</ContentPage.Resources>
<StackLayout>
<Label Text="Im a label" HorizontalOptions="{StaticResource HorzCenter}“
TextColor="{StaticResource TxtColor}" />
<Label Text="Im a label too, but different" HorizontalOptions="{StaticResource HorzCenter}“
TextColor="{StaticResource TxtRed}"/>
<Label Text="Im also a different label but look like the first label"
HorizontalOptions="{StaticResource HorzCenter}“
TextColor="{StaticResource TxtColor}"/>
</StackLayout>
 In the example below, we use the resource dictionary to define colors for
specific platforms and values that we plan to reuse like centering
Resource Dictionary hierarchy
 Resource files can inherit from global resource files
 Resource files prioritize definitions closer to where they
started in the hierarchy.
 Order of priority is View, Layout, Page, Application
Resource Dictionary Hierarchy
<ContentPage.Resources>
<ResourceDictionary>
<x:String x:Key="TxtL1">Im a label</x:String>
</ResourceDictionary>
</ContentPage.Resources>
<StackLayout>
<Label Text="{StaticResource TxtL1}"></Label>
</StackLayout>
<ContentPage.Resources>
<ResourceDictionary>
<x:String x:Key="TxtL1">I’m different</x:String>
</ResourceDictionary>
</ContentPage.Resources>
Page1.xaml
App.xaml
MVVM (Model-View-ViewModel)
 MVVM is a layer separated method of coding and organizing files
commonly found when using XAML.
Why Use Data Binding with Xamarin.Forms?
 Data Binding creates a one or two way relationship between
the source and target properties
 Must be used with a bindable property
Hands on Lab
What’s Next?
 Data Binding with Xamarin.Forms & XAML
 List views and collections with Data Binding, XAML, &
Xamarin.Forms
Questions?
mitchmuenster@gmail.com
@MobileRez
mobilerez.tumbler.com

More Related Content

What's hot

Xamarin Forms
Xamarin FormsXamarin Forms
Xamarin Forms
Peter Major
 
extending-and-optimizing-xamarin-forms-apps
extending-and-optimizing-xamarin-forms-appsextending-and-optimizing-xamarin-forms-apps
extending-and-optimizing-xamarin-forms-apps
Matthew Soucoup
 
Th03 lessons-learned-resilient-apps-mobile-app-services
Th03 lessons-learned-resilient-apps-mobile-app-servicesTh03 lessons-learned-resilient-apps-mobile-app-services
Th03 lessons-learned-resilient-apps-mobile-app-services
Matthew Soucoup
 
Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4
Xamarin
 
Xamarin cross platform
Xamarin cross platformXamarin cross platform
Xamarin cross platform
Guada Casuso
 
Introduction to Xamarin.Forms
Introduction to Xamarin.FormsIntroduction to Xamarin.Forms
Introduction to Xamarin.Forms
Pierce Boggan
 
Building On Demand Apps On Force.com
Building On Demand Apps On Force.comBuilding On Demand Apps On Force.com
Building On Demand Apps On Force.com
guneetsahai
 
Dotnetconf - Introduction to Xamarin and Xamarin.Forms
Dotnetconf - Introduction to Xamarin and Xamarin.FormsDotnetconf - Introduction to Xamarin and Xamarin.Forms
Dotnetconf - Introduction to Xamarin and Xamarin.Forms
James Montemagno
 
Xamarin.Forms: a cross-platform mobile UI toolkit - ConFoo 2016
Xamarin.Forms:  a cross-platform mobile UI toolkit - ConFoo 2016Xamarin.Forms:  a cross-platform mobile UI toolkit - ConFoo 2016
Xamarin.Forms: a cross-platform mobile UI toolkit - ConFoo 2016
Guy Barrette
 
Getting Started with iOS & Android Development Using Xamarin & Visual Studio
Getting Started with iOS & Android Development Using Xamarin & Visual StudioGetting Started with iOS & Android Development Using Xamarin & Visual Studio
Getting Started with iOS & Android Development Using Xamarin & Visual Studio
Mark Arteaga
 
#XamarinDevDays - Cross Platform Native UI with Xamarin.Forms
#XamarinDevDays - Cross Platform Native UI with Xamarin.Forms#XamarinDevDays - Cross Platform Native UI with Xamarin.Forms
#XamarinDevDays - Cross Platform Native UI with Xamarin.Forms
Udara Alwis
 
Mobile Cross-Platform App Development in C# with Xamarin
Mobile Cross-Platform App Development in C# with XamarinMobile Cross-Platform App Development in C# with Xamarin
Mobile Cross-Platform App Development in C# with Xamarin
Nick Landry
 
Elevate your Career on Clouds | Salesforce Developer Group
Elevate your Career on Clouds | Salesforce Developer GroupElevate your Career on Clouds | Salesforce Developer Group
Elevate your Career on Clouds | Salesforce Developer Group
Shivanath Devinarayanan
 
Xamarin Forms, MVVM and Testing
Xamarin Forms, MVVM and TestingXamarin Forms, MVVM and Testing
Xamarin Forms, MVVM and Testing
Gyuwon Yi
 
Animating Xamarin.Forms
Animating Xamarin.FormsAnimating Xamarin.Forms
Animating Xamarin.Forms
Matthew Soucoup
 
Couchbase Workshop - Introduction to Xamarin
Couchbase Workshop - Introduction to XamarinCouchbase Workshop - Introduction to Xamarin
Couchbase Workshop - Introduction to Xamarin
James Montemagno
 
Rain Concert - Rich Internet Application Development Expertise
Rain Concert - Rich Internet Application Development ExpertiseRain Concert - Rich Internet Application Development Expertise
Rain Concert - Rich Internet Application Development ExpertiseSeema Abhilash
 
Rich Internet Profile - Rainconcert
Rich Internet Profile - RainconcertRich Internet Profile - Rainconcert
Rich Internet Profile - Rainconcert
Rain Concert Technologies
 
Salesforce1 - Salesforce DUG Chennai
Salesforce1 - Salesforce DUG ChennaiSalesforce1 - Salesforce DUG Chennai
Salesforce1 - Salesforce DUG Chennai
Karanraj Sankaranarayanan
 
Use Xamarin.Forms and surprise your customers when develop native apps, in le...
Use Xamarin.Forms and surprise your customers when develop native apps, in le...Use Xamarin.Forms and surprise your customers when develop native apps, in le...
Use Xamarin.Forms and surprise your customers when develop native apps, in le...
Paulo Cesar Ortins Brito
 

What's hot (20)

Xamarin Forms
Xamarin FormsXamarin Forms
Xamarin Forms
 
extending-and-optimizing-xamarin-forms-apps
extending-and-optimizing-xamarin-forms-appsextending-and-optimizing-xamarin-forms-apps
extending-and-optimizing-xamarin-forms-apps
 
Th03 lessons-learned-resilient-apps-mobile-app-services
Th03 lessons-learned-resilient-apps-mobile-app-servicesTh03 lessons-learned-resilient-apps-mobile-app-services
Th03 lessons-learned-resilient-apps-mobile-app-services
 
Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4
 
Xamarin cross platform
Xamarin cross platformXamarin cross platform
Xamarin cross platform
 
Introduction to Xamarin.Forms
Introduction to Xamarin.FormsIntroduction to Xamarin.Forms
Introduction to Xamarin.Forms
 
Building On Demand Apps On Force.com
Building On Demand Apps On Force.comBuilding On Demand Apps On Force.com
Building On Demand Apps On Force.com
 
Dotnetconf - Introduction to Xamarin and Xamarin.Forms
Dotnetconf - Introduction to Xamarin and Xamarin.FormsDotnetconf - Introduction to Xamarin and Xamarin.Forms
Dotnetconf - Introduction to Xamarin and Xamarin.Forms
 
Xamarin.Forms: a cross-platform mobile UI toolkit - ConFoo 2016
Xamarin.Forms:  a cross-platform mobile UI toolkit - ConFoo 2016Xamarin.Forms:  a cross-platform mobile UI toolkit - ConFoo 2016
Xamarin.Forms: a cross-platform mobile UI toolkit - ConFoo 2016
 
Getting Started with iOS & Android Development Using Xamarin & Visual Studio
Getting Started with iOS & Android Development Using Xamarin & Visual StudioGetting Started with iOS & Android Development Using Xamarin & Visual Studio
Getting Started with iOS & Android Development Using Xamarin & Visual Studio
 
#XamarinDevDays - Cross Platform Native UI with Xamarin.Forms
#XamarinDevDays - Cross Platform Native UI with Xamarin.Forms#XamarinDevDays - Cross Platform Native UI with Xamarin.Forms
#XamarinDevDays - Cross Platform Native UI with Xamarin.Forms
 
Mobile Cross-Platform App Development in C# with Xamarin
Mobile Cross-Platform App Development in C# with XamarinMobile Cross-Platform App Development in C# with Xamarin
Mobile Cross-Platform App Development in C# with Xamarin
 
Elevate your Career on Clouds | Salesforce Developer Group
Elevate your Career on Clouds | Salesforce Developer GroupElevate your Career on Clouds | Salesforce Developer Group
Elevate your Career on Clouds | Salesforce Developer Group
 
Xamarin Forms, MVVM and Testing
Xamarin Forms, MVVM and TestingXamarin Forms, MVVM and Testing
Xamarin Forms, MVVM and Testing
 
Animating Xamarin.Forms
Animating Xamarin.FormsAnimating Xamarin.Forms
Animating Xamarin.Forms
 
Couchbase Workshop - Introduction to Xamarin
Couchbase Workshop - Introduction to XamarinCouchbase Workshop - Introduction to Xamarin
Couchbase Workshop - Introduction to Xamarin
 
Rain Concert - Rich Internet Application Development Expertise
Rain Concert - Rich Internet Application Development ExpertiseRain Concert - Rich Internet Application Development Expertise
Rain Concert - Rich Internet Application Development Expertise
 
Rich Internet Profile - Rainconcert
Rich Internet Profile - RainconcertRich Internet Profile - Rainconcert
Rich Internet Profile - Rainconcert
 
Salesforce1 - Salesforce DUG Chennai
Salesforce1 - Salesforce DUG ChennaiSalesforce1 - Salesforce DUG Chennai
Salesforce1 - Salesforce DUG Chennai
 
Use Xamarin.Forms and surprise your customers when develop native apps, in le...
Use Xamarin.Forms and surprise your customers when develop native apps, in le...Use Xamarin.Forms and surprise your customers when develop native apps, in le...
Use Xamarin.Forms and surprise your customers when develop native apps, in le...
 

Similar to Getting hands on with xaml and xamarin

Your First Xamarin.Forms App
Your First Xamarin.Forms AppYour First Xamarin.Forms App
Your First Xamarin.Forms App
Craig Dunn
 
Xamarin Development
Xamarin DevelopmentXamarin Development
Xamarin Development
Alper Ebicoglu
 
Xamarin.Forms Hands On Lab (Begineer)
Xamarin.Forms Hands On Lab (Begineer)Xamarin.Forms Hands On Lab (Begineer)
Xamarin.Forms Hands On Lab (Begineer)
Cheah Eng Soon
 
Xamarin forms from zero to hero
Xamarin forms from zero to heroXamarin forms from zero to hero
Xamarin forms from zero to hero
Charlin Agramonte
 
Xamarin the good, the bad and the ugly
Xamarin  the good, the bad and the uglyXamarin  the good, the bad and the ugly
Xamarin the good, the bad and the ugly
Azilen Technologies Pvt. Ltd.
 
App innovationcircles xamarin
App innovationcircles xamarinApp innovationcircles xamarin
App innovationcircles xamarin
Mohit Chhabra
 
Xamarin overview droidcon.tn
Xamarin overview   droidcon.tnXamarin overview   droidcon.tn
Xamarin overview droidcon.tn
Houssem Dellai
 
Cross platform mobile app development with Xamarin
Cross platform mobile app development with XamarinCross platform mobile app development with Xamarin
Cross platform mobile app development with Xamarin
Pranav Ainavolu
 
Xamarin 101
Xamarin 101Xamarin 101
Xamarin 101
Chester Hartin
 
Developing Application in WP7
Developing Application in WP7Developing Application in WP7
Developing Application in WP7
Kunal Chowdhury
 
Xamarin. Forms vs. Xamarin Native_ How to choose_.pdf
Xamarin. Forms vs. Xamarin Native_ How to choose_.pdfXamarin. Forms vs. Xamarin Native_ How to choose_.pdf
Xamarin. Forms vs. Xamarin Native_ How to choose_.pdf
MoonTechnolabsPvtLtd
 
Building Accessible Apps using NET MAUI.pdf
Building Accessible Apps using NET MAUI.pdfBuilding Accessible Apps using NET MAUI.pdf
Building Accessible Apps using NET MAUI.pdf
SivarajAmbat1
 
Stunning Mobile Apps with the Xamarin Visual Design System​
Stunning Mobile Apps with the Xamarin Visual Design System​Stunning Mobile Apps with the Xamarin Visual Design System​
Stunning Mobile Apps with the Xamarin Visual Design System​
James Montemagno
 
Windows phone 8 session 3
Windows phone 8 session 3Windows phone 8 session 3
Windows phone 8 session 3hitesh chothani
 
Get Native-like Mobile Apps Using Xamarin Development
Get Native-like Mobile Apps Using Xamarin DevelopmentGet Native-like Mobile Apps Using Xamarin Development
Get Native-like Mobile Apps Using Xamarin Development
Sara Suarez
 
About XAML & HTML+CSS
About XAML & HTML+CSSAbout XAML & HTML+CSS
About XAML & HTML+CSS
Ahmad Awsaf-uz-zaman
 
APAC Webinar: Say Hello To Xamarin.Forms
APAC Webinar: Say Hello To Xamarin.FormsAPAC Webinar: Say Hello To Xamarin.Forms
APAC Webinar: Say Hello To Xamarin.Forms
Nish Anil
 
Chpater1
Chpater1Chpater1
Chpater1
Engleang Sam
 
Windows 8 app bar and live tiles
Windows 8 app bar and live tilesWindows 8 app bar and live tiles
Windows 8 app bar and live tilesAmr Abulnaga
 

Similar to Getting hands on with xaml and xamarin (20)

Your First Xamarin.Forms App
Your First Xamarin.Forms AppYour First Xamarin.Forms App
Your First Xamarin.Forms App
 
Xamarin Development
Xamarin DevelopmentXamarin Development
Xamarin Development
 
Xamarin.Forms Hands On Lab (Begineer)
Xamarin.Forms Hands On Lab (Begineer)Xamarin.Forms Hands On Lab (Begineer)
Xamarin.Forms Hands On Lab (Begineer)
 
Xamarin forms from zero to hero
Xamarin forms from zero to heroXamarin forms from zero to hero
Xamarin forms from zero to hero
 
Xamarin the good, the bad and the ugly
Xamarin  the good, the bad and the uglyXamarin  the good, the bad and the ugly
Xamarin the good, the bad and the ugly
 
App innovationcircles xamarin
App innovationcircles xamarinApp innovationcircles xamarin
App innovationcircles xamarin
 
Xamarin overview droidcon.tn
Xamarin overview   droidcon.tnXamarin overview   droidcon.tn
Xamarin overview droidcon.tn
 
Cross platform mobile app development with Xamarin
Cross platform mobile app development with XamarinCross platform mobile app development with Xamarin
Cross platform mobile app development with Xamarin
 
Xamarin 101
Xamarin 101Xamarin 101
Xamarin 101
 
Developing Application in WP7
Developing Application in WP7Developing Application in WP7
Developing Application in WP7
 
Xamarin. Forms vs. Xamarin Native_ How to choose_.pdf
Xamarin. Forms vs. Xamarin Native_ How to choose_.pdfXamarin. Forms vs. Xamarin Native_ How to choose_.pdf
Xamarin. Forms vs. Xamarin Native_ How to choose_.pdf
 
Building Accessible Apps using NET MAUI.pdf
Building Accessible Apps using NET MAUI.pdfBuilding Accessible Apps using NET MAUI.pdf
Building Accessible Apps using NET MAUI.pdf
 
Stunning Mobile Apps with the Xamarin Visual Design System​
Stunning Mobile Apps with the Xamarin Visual Design System​Stunning Mobile Apps with the Xamarin Visual Design System​
Stunning Mobile Apps with the Xamarin Visual Design System​
 
Windows phone 8 session 3
Windows phone 8 session 3Windows phone 8 session 3
Windows phone 8 session 3
 
Get Native-like Mobile Apps Using Xamarin Development
Get Native-like Mobile Apps Using Xamarin DevelopmentGet Native-like Mobile Apps Using Xamarin Development
Get Native-like Mobile Apps Using Xamarin Development
 
About XAML & HTML+CSS
About XAML & HTML+CSSAbout XAML & HTML+CSS
About XAML & HTML+CSS
 
APAC Webinar: Say Hello To Xamarin.Forms
APAC Webinar: Say Hello To Xamarin.FormsAPAC Webinar: Say Hello To Xamarin.Forms
APAC Webinar: Say Hello To Xamarin.Forms
 
Chpater1
Chpater1Chpater1
Chpater1
 
APP-A-THON
APP-A-THONAPP-A-THON
APP-A-THON
 
Windows 8 app bar and live tiles
Windows 8 app bar and live tilesWindows 8 app bar and live tiles
Windows 8 app bar and live tiles
 

Recently uploaded

PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 

Recently uploaded (20)

PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 

Getting hands on with xaml and xamarin

  • 1. Getting hands on with XAML and Xamarin.Forms Mitch “Rez” Muenster @MobileRez mobilerez.tumbler.com Xamarin Certified Developer
  • 2. What is this about?  Using Xamarin.Forms  Working with XAML Syntax & Behavior  Using Advanced XAML  Doing more then just a Tech talk but letting you code
  • 4. What is Xamarin.Forms?  Xamarin.Forms is a software framework that lets you build one app with UI and behavior and deploy it to each of the mobile platforms
  • 5. Understanding Xamarin.Forms UI  Xamarin.Forms UI is defined in 4 different ways; Pages, Layouts, Cells, and Views.
  • 6. What is a Page?  A page is used to define a single screen that contains most or all of the screen.
  • 7. What is a Layout?  A layout is a special type of view that acts as a container for other views or layouts.
  • 8. What is a View?  A View is the term Xamarin.Forms uses for all its basic controls from Buttons to Progress Bars.  Some of the Views Xamarin.Forms contains are  Button  Date Picker  Entry (input box)  Label  Picker (The phones form of dropdown list)  Progress Bar A full list of Views at https://developer.xamarin.com/guides/cross-platform/xamarin-forms/controls/views/
  • 9. What is a Cell?  A Cell is a special element that is used inside tables and defines how each item in a list is rendered.  An example of Cells Xamarin.Forms supports:  Entry Cell  Switch Cell  Text Cell  Image Cell A full list of Cells at https://developer.xamarin.com/guides/cross-platform/xamarin-forms/controls/cells/
  • 10. Traditional way to build Forms apps  Xamarin.Forms apps are commonly built using all using C# and not XAML.  A new Xamarin.Forms app is usually created with a dummy app in a cs file public App() { // The root page of your application MainPage = new ContentPage { Content = new StackLayout { VerticalOptions = LayoutOptions.Center, Children = { new Label { XAlign = TextAlignment.Center, Text = "Welcome to Xamarin Forms!“ } } } }; }
  • 11. Working with XAML Syntax & Behavior
  • 12. What is XAML?  XAML stands for Extensible Application Markup Language and was created by Microsoft specifically for working with the UI  A XAML file is always associated with a C# code file.
  • 13. Why use XAML over all code in a .cs file?  Designer can create UI while coder focuses on code in the code file  XAML allows for features like DataBinding Animations, Custom behaviors, value converters & more.  Easier to work with for those who like to have a more visual representation of their layouts  Helps keep a separation between UI and app logic
  • 14. Building a layout in XAML <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Toolbox.View.Page1"> <StackLayout> <StackLayout.Padding> <OnPlatform x:TypeArguments="Thickness“ iOS="0, 20, 0, 0"/> </StackLayout.Padding> <Label Text="{Binding MainText}" VerticalOptions="Center" HorizontalOptions="Center" /> </StackLayout> </ContentPage>
  • 15. XAML Syntax: Attached properties & Property Elements <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Toolbox.View.MunitConverter“> <StackLayout VerticalOptions="CenterAndExpand" Padding="20" > <Grid HorizontalOptions="Center" > <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> <RowDefinition Height="*"/> <RowDefinition Height="*"/> <RowDefinition Height="*"/> <RowDefinition Height="*"/> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> ... <Label x:Name="endLabel" Grid.Row="7" StyleId="EndLabel" XAlign="Center"/> </Grid> </StackLayout> </ContentPage>
  • 16. Platform Targeted Tweaks  Building a cross platform app means you may need to tweak a specific platform or device class (phone or tablet) to make it match the other platforms. To do this we can use OnPlatform and OnIdiom
  • 17. OnPlatform & OnIdiom  OnPlatform allows us to define code for a specific platform  OnIdiom allows us to define code for either a tablet or phone  Both are useful for providing those quick tweaks to get the UI to look the same on all devices or only changing one platform to fit the rest of their needs  Can be used with padding, color, size, font, width, height, and strings/text
  • 18. OnPlatform & OnIdiom In Action  OnPlatform is used here to add a thickness at the top of the app on iOS to make room for the top menu. OnIdiom Is used to set a color based on the platform. <StackLayout> <StackLayout.Padding> <OnPlatform x:TypeArguments="Thickness“ Android="0, 0, 0, 0“ iOS="0, 20, 0, 0“ WinPhone="0, 0, 0, 0"/> </StackLayout.Padding> <StackLayout.BackgroundColor> <OnIdiom x:TypeArguments="Color“ Phone="Teal“ Tablet="Green"/> </StackLayout.BackgroundColor> <Label Text="{Binding MainText}" VerticalOptions="Center" HorizontalOptions="Center" /> </StackLayout>
  • 20. Reducing Duplicated styles with XAML  When defining multiple and app wide styles, we run into the issue of needing to get the most out of our code and limit reuse or duplication of similar styles. In XAML we can do this with Resource Dictionaries.
  • 21. Resource Dictionary's  A Resource Dictionary Is a dictionary that can be defined in the XAML or code behind and is used to hold UI resources such as colors, fonts, and styles.  A resource in the Dictionary Uses the x:Key to define the ID of that resource so you can reference it later.
  • 22. Using a Resource Dictionary <ContentPage.Resources> <ResourceDictionary> <Color x:Key="TxtRed">Red</Color> <OnPlatform x:Key="TxtColor“ x:TypeArguments="Color“ Android="Green“ iOS="Teal“ WinPhone="Purple"/> <LayoutOptions x:Key="HorzCenter">Center</LayoutOptions> </ResourceDictionary> </ContentPage.Resources> <StackLayout> <Label Text="Im a label" HorizontalOptions="{StaticResource HorzCenter}“ TextColor="{StaticResource TxtColor}" /> <Label Text="Im a label too, but different" HorizontalOptions="{StaticResource HorzCenter}“ TextColor="{StaticResource TxtRed}"/> <Label Text="Im also a different label but look like the first label" HorizontalOptions="{StaticResource HorzCenter}“ TextColor="{StaticResource TxtColor}"/> </StackLayout>  In the example below, we use the resource dictionary to define colors for specific platforms and values that we plan to reuse like centering
  • 23. Resource Dictionary hierarchy  Resource files can inherit from global resource files  Resource files prioritize definitions closer to where they started in the hierarchy.  Order of priority is View, Layout, Page, Application
  • 24. Resource Dictionary Hierarchy <ContentPage.Resources> <ResourceDictionary> <x:String x:Key="TxtL1">Im a label</x:String> </ResourceDictionary> </ContentPage.Resources> <StackLayout> <Label Text="{StaticResource TxtL1}"></Label> </StackLayout> <ContentPage.Resources> <ResourceDictionary> <x:String x:Key="TxtL1">I’m different</x:String> </ResourceDictionary> </ContentPage.Resources> Page1.xaml App.xaml
  • 25. MVVM (Model-View-ViewModel)  MVVM is a layer separated method of coding and organizing files commonly found when using XAML.
  • 26. Why Use Data Binding with Xamarin.Forms?  Data Binding creates a one or two way relationship between the source and target properties  Must be used with a bindable property
  • 28. What’s Next?  Data Binding with Xamarin.Forms & XAML  List views and collections with Data Binding, XAML, & Xamarin.Forms

Editor's Notes

  1. For our objectives today, cover Xamarin.Forms to get a better understand of what it is and the layouts that exist within Forms Then We will be getting into a understanding of XAML, its Syntax and Behavior and how it works with Xamarin.Forms and then touching on a few advanced XAML concepts that can be used with your Xamarin.Forms app to bring in adisi
  2. ~ Can also use dependency service to access platform specific features. ~ Great for Prototyping or Data-Driven apps. ~ Can be created in either a Shared Class Library or Portable Class Library
  3. A Xamarin.Forms.Page represents a View Controller in iOS or a Page in Windows Phone. On Android each page takes up the screen like an Activity, but Xamarin.Forms Pages are not Activities. ContentPage – A page that displays a single view. MasterDetailPage – A page that manages two pains of information. NavigationPage - A NavigationPage manages the transition between a stack of pages. TabbedPage – A page that contains navigation between pages using tabs. CarouselPage – A page who's navigation is achieved via swipe gestures between similar content (I.e. images or a listing of classes).
  4. A Xamarin.Forms Layout typically contains logic to set the position and size of child elements in Xamarin.Forms applications. StackLayout – A Layout that positions child elements in a single line. AbsoluteLayout – Positions child elements at absolute requested positions. RelativeLayout – A Layout that uses Constraints to position its children. GridLayout – A layout containing views arranged in rows and columns. ContentView – An element with a single content. ContentView has very little use of its own. Its purpose is to serve as a base class for user-defined compound views. ScrollView - An element capable of scrolling if it's Content requires. Frame - An element containing a single child, with some framing options. 
  5. Views in Xamarin.Forms are the building blocks of cross-platform mobile user interfaces. Platform defines a renderer for each view that creates a native representation of the UI
  6. Mixing UI and behavior all in one file can make design and behavior harder to understand or change as the app grows. Forces the developer to do all the work (no way to include a designer unless they understand code as well)
  7. talk about the content at the top, what standards its using, etc. (Xamarin.Forms conforms to XAML 2009 Specification, the differences are in the layout and containers used)
  8. XAML Header: Content Page: Layout (usually): Elements: (labels, buttons, pickers etc.) While not essential to make a XAML file, XAML files may also contain things such as property elements, databinding, platform specific definition, and attached properties
  9. Layouts such as the grid has special property called attached properties. Attached properties are set in the child of a tag like grid. Attached properties are easy to tell because they contain both a class and property name They get their name because they are defined by one class but attach to other objects
  10. OnPlatform: defines properties based on if it is an Android, iOS or Windows device OnIdiom: defines properties specific to a phone or tablet As of right now, you cannot use OnPlatform and OnIdiom together. Instead it requreies you to think about your latouts i.e. using a grid for autosizing or setting stack orientation to vertical on phone and horizontal on tablet.
  11. OnPlatform: defines properties based on if it is an Android, iOS or Windows device OnIdiom: defines properties specific to a phone or tablet As of right now, you cannot use OnPlatform and OnIdiom together. Instead it requreies you to think about your latouts i.e. using a grid for autosizing or setting stack orientation to vertical on phone and horizontal on tablet.
  12. OnPlatform: defines properties based on if it is an Android, iOS or Windows device OnIdiom: defines properties specific to a phone or tablet As of right now, you cannot use OnPlatform and OnIdiom together. Instead it requires you to think about your layouts i.e. using a grid for auto sizing or setting stack orientation to vertical on phone and horizontal on tablet.
  13. OnPlatform: defines properties based on if it is an Android, iOS or Windows device OnIdiom: defines properties specific to a phone or tablet As of right now, you cannot use OnPlatform and OnIdiom together. Instead it requreies you to think about your latouts i.e. using a grid for autosizing or setting stack orientation to vertical on phone and horizontal on tablet.
  14. Resource dictionary’s help keep your XAML clean and helps you to not redefine elements (its like a css for XAML) Can Use OnPlatform & OnIdiom to set resources (platform or device dependicies) You can also set styles in your resource dictionary (starting with <Style TargetType=”button”> and then define setters inside <Setter Property=“BackgroundColor” Value=“#2A84D3/> Just remember that the properties must be members of the TargetType class or else a runtime error will occour
  15. Resource dictionary’s help keep your XAML clean and helps you to not redefine elements (its like a css for XAML) Can Use OnPlatform & OnIdiom to set resources (platform or device dependicies) You can also set styles in your resource dictionary (starting with <Style TargetType=”button”> and then define setters inside <Setter Property=“BackgroundColor” Value=“#2A84D3/> Just remember that the properties must be members of the TargetType class or else a runtime error will occour
  16. Page specific resources take presidence over app wide resources App wide resources are where the end of the line is. If it cant find it after checking app wide, then it will error. One page cannot call resources from another page
  17. View: The view is the UI. It manages all the visual aspects and should not be where you place your code you want to unit test. Model: The model Manages the application data and may include domain logic, persisted state, & validation ViewModel: The View Model provides a representation of the data centered around the view. It also enables easier conversion of methods or model properties and provides a way to access related data via bindings.
  18. Binding acts as the intermediary between the source and the target to move data along.