Xamarin.Forms ContextActions, Binding and Mvvm Code Sample

How to bind a ContextAction in a Xamarin Forms ListView to a View Model?  This is a question I was asked recently.   I created a simple code sample for this, so thought I’d share it with everyone.

 

Below is a link to the sample on GitHub.    It includes an example of how to do it in code and in XAML.

 

 

https://github.com/apead/FormsMvvmContextActionSample

 

Happy Xamarin.Forms Coding!

Getting Started with .NET Core

.NET core is really easy to get up and running.     Download the installer relevant to your environment from https://www.microsoft.com/net/download/core   An IDE such as Visual Studio is optional.  I’m going to start with the command line version as it’s really quick to get running.   It also doesn’t need much resources for a development environment, which is great as I’m currently using a Samsung Tablet with 2 Gig of RAM to write this blog post.

 

There is a “Current” and a “LTS” version.   Choose which version suites your support needs.   “LTS” versions are supported for 3 years.   “Current” is the latest version, and is supported for 3 months.    I’m going to use “Current” here as it contains all the new juicy bits.

 

.NET Core Installer

 

The installer will take a minute or two to run.  Once installed, the executable “dotnet” will be added to the path.  Also different version of .NET will be installed side by side.

 

C:\blog\dotnet

Microsoft .NET Core Shared Framework Host

Version : 1.1.0
Build : 928f77c4bc3f49d892459992fb6e1d5542cb5e86

Usage: dotnet [common-options] [[options] path-to-application]

Common Options:
--help Display .NET Core Shared Framework Host help.
--version Display .NET Core Shared Framework Host version.

Options:
--fx-version <version> Version of the installed Shared Framework to use to run the application.
--additionalprobingpath <path> Path containing probing policy and assemblies to probe for.

Path to Application:
The path to a .NET Core managed application, dll or exe file to execute.

If you are debugging the Shared Framework Host, set 'COREHOST_TRACE' to '1' in your environment.

To get started on developing applications for .NET Core, install the SDK from:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409

C:\blog\

 

To create a new app, there’s a “new” command.   On first execution it will extract and expand, which may take a moment.

 

Welcome to .NET Core!
---------------------
Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.
Telemetry
--------------
The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include commandline arguments. The data is collected by Microsoft and shared with the community.
You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell.
You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry.
Configuring...
-------------------
A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once.
Decompressing 100% 2294 ms
Expanding 100% 4502 ms

 

By default, the “dotnet new” command will create a console app. Issuing a “dotnet restore” command, all required packages will be fetched.

02/14/2017 03:01 PM <DIR> .
02/14/2017 03:01 PM <DIR> ..
02/14/2017 03:01 PM 0 dotnet
11/11/2016 12:10 AM 214 Program.cs
11/11/2016 12:10 AM 367 project.json
 3 File(s) 581 bytes
 2 Dir(s) 92,367,912,960 bytes free

C:\blog\dotnet restore
log : Restoring packages for C:\blog\project.json...
log : Writing lock file to disk. Path: C:\blog\project.lock.json
log : C:\blog\project.json
log : Restore completed in 899ms.

C:\blog\

 

To run the application simply type “dotnet run”.

C:\blog\dotnet run
Project blog (.NETCoreApp,Version=v1.1) will be compiled because expected outputs are missing
Compiling blog for .NETCoreApp,Version=v1.1

Compilation succeeded.
 0 Warning(s)
 0 Error(s)

Time elapsed 00:00:00.6861620


Hello World!

C:\blog\

 

There are various project types:  console, web, lib and xunittest.   The type can be specified with the -t parameter.  The language can be specified with the -l parameter.  The available languages are C# and F#

 

To create a ASP .NET Core / web app, type:   “dotnet new -t web”

 

C:\blog\web>dotnet new -t web
Created new C# project in C:\blog\web.

C:\blog\web>dir
Volume in drive C has no label.
Volume Serial Number is 4A07-921B

Directory of C:\blog\web

02/14/2017 03:12 PM <DIR> .
02/14/2017 03:12 PM <DIR> ..
11/11/2016 12:10 AM 36 .bowerrc
11/11/2016 12:10 AM 3,889 .gitignore
11/11/2016 12:10 AM 265 appsettings.json
11/11/2016 12:10 AM 214 bower.json
02/14/2017 03:12 PM <DIR> Controllers
02/14/2017 03:12 PM <DIR> Data
11/11/2016 12:10 AM 1,193 gulpfile.js
02/14/2017 03:12 PM <DIR> Models
11/11/2016 12:10 AM 239 package.json
11/11/2016 12:10 AM 574 Program.cs
11/11/2016 12:10 AM 3,397 project.json
11/11/2016 12:10 AM 2,229 README.md
02/14/2017 03:12 PM <DIR> Services
11/11/2016 12:10 AM 3,193 Startup.cs
02/14/2017 03:12 PM <DIR> Views
11/11/2016 12:10 AM 563 web.config
02/14/2017 03:12 PM <DIR> wwwroot
11 File(s) 15,792 bytes
8 Dir(s) 92,065,746,944 bytes free

C:\blog\web>

 

Running the web application is simple: the  “dotnet run” command will make this happen.   It will even host it in web container.

 

C:\blog\web>dotnet run
Project web (.NETCoreApp,Version=v1.1) will be compiled because expected outputs are missing
Compiling web for .NETCoreApp,Version=v1.1
C:\blog\web\project.json(5,30): warning NU1007: Dependency specified was Microsoft.NETCore.App >= 1.1.0-preview1-001153-00 but ended up with Microsoft.NETCore.App 1.1.0.

Compilation succeeded.
1 Warning(s)
0 Error(s)

Time elapsed 00:00:01.3100351
info: Microsoft.Extensions.DependencyInjection.DataProtectionServices[0]
User profile is available. Using 'C:\Users\apead\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
Hosting environment: Production
Content root path: C:\blog\web
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
ASP .NET core landing page

 

Browsing to the URL presented:  “http://localhost:5000” will display the ASP .NET core default landing page.   This page is also quite useful as it contains links to various learning resources.

 

.NET core development can be done using any text editor, or in the cross platform lightweight editor Visual Studio Code, or if you prefer the full featured IDE Visual Studio.

 

Happy .NET core development!

 

 

 

 

Xamarin User Groups in South Africa

There are three Xamarin User Groups in South Africa.   Here you will find monthly topics which will include both .NET and Xamarin mobile related topics.

 

The groups are there to bring the Xamarin community together, where knowledge can be shared and experiences learnt from.    Hope you see you at an event soon!

 

Twitter:  https://twitter.com/ctxug

Cape Town Xamarin Users Group (@CTXUG)

Cape Town, ZA
170 Members

Calling everyone interested in cross platform mobile development. Specifically if you are interested in or using Xamarin tools. Or if you just want to talk mobile development …

Check out this Meetup Group →

Twitter:  https://twitter.com/gxugsa

Gauteng Xamarin User Group (@GXUGSA)

Johannesburg, ZA
179 Members

Calling everyone interested in cross platform mobile development. Specifically if you are interested in or using Xamarin tools. Or if you just want to talk mobile development …

Next Meetup

Motion & Xamarin.Forms

Tuesday, Mar 14, 2017, 6:30 PM
15 Attending

Check out this Meetup Group →

Twitter:  https://twitter.com/DXUGSA

Durban Xamarin User Group (@DXUGSA)

Durban, ZA
64 Members

Calling all cross platform developers, from Durban, that use Xamarin as their preferred tool of choice.

Check out this Meetup Group →

Xamarin and .NET automated builds and continuous integration (CTXUG)

Come join us for a very practical session on automating your Xamarin builds and setting up a continuous integration environment.

Leave here with skills to be able to use any CI tooling with Xamarin.

I am the speaker for this event.

 

Agenda 

1) Introduction to Continuous Integration

2) How does Xamarin build stuff behind the scenes?

Fundamentals of MSBUILD

Xamarin and MS Build

iOS build agent for Visual Studio

iOS and Android Packaging

3)  Setting up a continuous build server

The  code repository

Automating the build

4)  Test Cloud

 

We will also have a first look at Visual Studio Mobile Center.

 

Hope to see you there!

 

Update

 

The content is available here:  https://github.com/apead/XUGSABuildAutomation

Xamarin Dev Days South Africa

Xamarin Dev Days South Africa was amazing!   Thank you very much to all that attended and hope it was  worthwhile to take time off your busy scheduled to learn about Xamarin.

 

I am so proud to have been part of this and thank you to the team and all involved!

 

Xamarin Dev Days Cape Town

http://explorationspace.co.za/2016/09/30/xamarin-dev-days-cape-town-30-septemeber-2016/

 

Xamarin Dev Days Johannesburg

http://explorationspace.co.za/2016/09/23/xamarin-dev-days-johannesburg-23-september-2016/

 

Xamarin Dev Days South Africa

 

Xamarin Dev Days Cape Town 30 September 2016

Xamarin Dev Days Cape Town was definitely one of the prettiest dev days in world.   Thanks to all that came!

I’m so proud to have been part of  bringing Xamarin Dev Days to Africa for the first time.   May there be many more!!

 

What the day entailed:

 

Xamarin Dev Days Agenda

 

09:00 AM – 09:30 AM Registration

09:30 AM –  10:10 AM Intro Xamarin presentation

10:20 AM – 11:00 AM  Cross-platform Xamarin presentation

11:10 AM – 11:50 AM Cloud Xamarin presentation

12:00 PM – 12:45 PM Lunch

12:45 PM – 1:30 PM Sponsor speaker slot (Zebra)

01:30 PM – 16:30 PM Hackathon Challenge Walkthrough

 

Local Organizers & Xamarin Experts

Special thanks to the sponsors:

Microsoft South Africa   http://www.microsoft.com

Zebra Technologies  http://www.zebra.com

MLab  https://www.mlab.co.za/

AD Software Systems  http://www.adsoftsystems.co.za

 

The event in pictures:

 

Xamarin Dev Days with a View!

 

Rodger Weis on stage!

 

Martin on Stage!

 

Brent Samodien on Stage!

 

Lebo talking about MLab

 

Yummy Deserts!

 

Awesome turnout!

 

Awesome Venue!

 

Our awesome sponsor Zebra showcasing their devices

 

Lebo and Chris doing prep

 

Xamarin Dev Days Johannesburg 23 September 2016

The turnout at Xamarin Dev Days Johannesburg was amazing!!   Thanks to all that came.

 

I’m so proud to have been part of  bringing Xamarin Dev Days to Africa for the first time.   May there be many more!!

 

What the day entailed:

 

Xamarin Dev Days Agenda

 

09:00 AM – 09:30 AM Registration

09:30 AM –  10:10 AM Intro Xamarin presentation

10:20 AM – 11:00 AM  Cross-platform Xamarin presentation

11:10 AM – 11:50 AM Cloud Xamarin presentation

12:00 PM – 12:45 PM Lunch

12:45 PM – 1:30 PM Sponsor speaker slot (Zebra)

01:30 PM – 16:30 PM Hackathon Challenge Walkthrough

 

 

Local Organizers & Xamarin Experts

 

Special thanks to the sponsors:

 

Microsoft South Africa   http://www.microsoft.com

 

Zebra Technologies  http://www.zebra.com

MLab  https://www.mlab.co.za/

AD Software Systems  http://www.adsoftsystems.co.za

 

The event in pictures:

 

Lovely ladies from Zebra

 

Setting Up

 

 

Andre from Zebra on Stage

 

 

Dustyn Lightfoot on Stage

 

Dave Russell on Stage

 

Yummy food

 

Gert Smith on Stage

 

The day before setting up

 

Great turnout!

Xamarin Dev Days Announced (with Dates)

I’m very excited to be able to tell you we are brining Xamarin Dev Days to South Africa for the first time!   It will also be held in two cities,  Cape Town and Johannesburg.

 

We have our venues and sponsors organized, and more importantly the dates.

 

Please diarise!

 

Xamarin Dev Days Cape Town will be held on the 30th of September 2016.    It will be held at Workshop 17 at the V&A.

 

Xamarin Dev Days Johannesburg will be held on the 23rd of September 2016.    It will be held at the Microsoft Bryanston offices.

 

The awesome sponsors are:

 

Microsoft South Africa   http://www.microsoft.com

Zebra Technologies  http://www.zebra.com

MLab  https://www.mlab.co.za/

AD Software Systems  http://www.adsoftsystems.co.za

 

Without them, these events would definitely not be possible!!   Thank you!