Learning Xamarin.Forms – Part 3: Navigation

This series begins with an overview here
In Part 2 we considered MVVM

This series is based on my Pluralsight Course: Building Your First Mobile Application with Xamarin.Forms and Visual Studio 2017

Navigation

Just about any serious mobile application will have two or more “pages.”  (We’re going to refer to pages throughout this series, though that is less meaningful in mobile apps than it is in, for example, desktop applications).

The starting point for Xamarin.Forms navigation is with the Navigation service.  To see how this works, let’s create a new Xamarin.Forms (blank) application named NavigationDemo.

Continue reading

Posted in Essentials, Xamarin | Tagged , | Leave a comment

Learning Xamarin.Forms – Part 2: MVVM

I think many would argue that discussing MVVM is premature in part 2 of a discussion on Xamarin.Forms.  My counter argument is that it is important to start out with best practices, and MVVM is the pattern of choice for Xamarin.Forms

 

Note, this blog post is based on my Pluralsight Course

OK, What Is MVVM?

MVVM was created (or more accurately, it evolved from previous patterns) along with the development of WPF and later, Silverlight.  Projects that use XAML for the development of a User Interface are particularly good candidates for this pattern.

MVVM  is nothing more (and nothing less!) than a way to create a clean separation of concerns among the various classes of your app, and to ensure that your app is testable and that dependencies are minimized or eliminated.

MVVM stands for Model – View – ViewModel.  This implies a separation of your code into the domain-relevant data (the Model) and the representation of data (the View) and finally, the logic (sometimes called the business logic) of your program (the ViewModel)

Continue reading

Posted in Essentials, Xamarin | Tagged , | 2 Comments

Learning Xamarin.Forms – Part 1 – Overview

About this series

This post begins a series in which I will introduce Xamarin.Forms, put it in context and then teach all you need to know to go from absolute beginner to intermediate/advanced Xamarin.Forms programmer.  I assume no prior mobile programming experience, though you will need to know C#.

This series is based on my new Pluralsight Course: Building Your First Mobile Application with Xamarin.Forms and Visual Studio 2017 

 

What Is Xamarin.Forms?

My guess is that if you are reading this you probably know, so I’ll be brief:

  • Native Xamarin allows you to create native iOS and Android (and other) apps in C#, writing the User Interface individually for each platform
  • Xamarin.Forms allows you to create native iOS and Android (and other) apps in C# with a shared User Interface.

With Xamarin.Forms you write to a common set of “controls” or “views” and these are translated to native controls when the program is created.  Xamarin.Forms applications are indistinguishable from native applications because, by the time they hit the phone, they are native apps.

Continue reading

Posted in Essentials, Xamarin | Tagged , , | 5 Comments

New Course: Source Code Control With Git Using SourceTree

(Click on image to go to course)

 

 

Posted in Essentials, Git, Source Control | Tagged , | Leave a comment

Yet Another Podcast #172 – James Montemagno on Embedding

Talking with James Montemagno, Principal Program Manager for Mobile Developer Tools at Microsoft

 

 

Posted in Essentials | Tagged , | 1 Comment

Asking Questions That Get Answers

This is from my Help! page, but I thought it might be worth blogging here as well…

 

Creating a Question That Is Likely To Be Answered

whisperThere are a few techniques that make for a question that is likely to be answered quickly and well. While none of this is a surprise, take a look at the questions that are posted, most don’t follow these simple guidelines:

Summarize your question in the topic

Most folks are more likely to open a question with the topic “How Do I sort a column in a datagrid” than one with the topic “Help, Urgent!” even though the latter may, in fact, be more urgent

Be Brief, Be Precise

A long rambling message whose point is hard to fathom is hard to answer.

Write Down the Exception or Error Message

It is far easier to help someone if they way “when I click on the button the second time I get a an exception saying that I’ve tried to access a null object,” than it is to help someone who writes “Sometimes my program blows up and I get an error.”

Provide An Example

The single most effective thing you can do to get help is to write the smallest and simplest example that shows the problem. It should be so small it fits cleanly into your message – not as an attachment (many folks are reluctant to open attachments). It should do only one thing, and that is: illustrate the problem; and it should be self-revealing.

What A Great Question Might Look Like:

Topic: When I add data to my listBox I sometimes get an “Index was outside the bounds of the array”

Message: I have a program that adds strings to a listBox based on the user pressing a button. Here is a stripped down example. In the Xaml I declare a button and a list box:

using System.Windows;
using System.Windows.Controls;

namespace Error
{
   public partial class MainPage : UserControl
   {
      string[] data = new string[] { "a", "b", "c", "d" };

      public MainPage()
      {
         InitializeComponent();
         AddFieldToListBox.Click +=
         new RoutedEventHandler( AddFieldToListBox_Click );
      }

      void AddFieldToListBox_Click(
           object sender, RoutedEventArgs e )
      {
         for ( int i = 0; i <= data.Length; i++ )
         {
             ListOfText.Items.Add( data[ i ] );
         }
      }
   }
}

The error happens on line 22 (adding the data). I don’t see how it is out of bounds.

This is a fairly plausible error for a newbie to run into and it is an inviting question to answer: the topic tells me what I’m dealing with, the message is very short but tells me what I need to know and the example, while short, makes obvious where the problem is.

Key here is short – the shorter your message and the smaller your example, the more likely you are to get an answer; don’t make the people who want to help you work harder than necessary.

Posted in Essentials | Leave a comment

DevIntersections Advanced C# Code

For those of you who attended my session on Advanced C#, here is a zip of the examples.  Thanks

Posted in Essentials | 2 Comments

Yet Another Podcast #171 – MFractor

 

Talking with Matthew Robbins, creator of MFractor.  MFractor is a set of extraordinary tools for Visual Studio Mac.

  • Twitter: @matthewrdev
  • Sack: #mfractor Xamarin Slack sub-channel
  • Email: hello@mfractor.com
  • Web: http://mfractor.com 

 

 

 

Posted in Essentials | Tagged | Leave a comment

Yet Another Podcast #170 – Windows Template Studio

Create UWP Applications with a template wizard…

Clint Rutkas is a Sr. Product Manager for Windows focusing on the developer platform.  He has worked at 343 Industries on Halo and on Channel 9 and built some crazy projects using Windows technology like a computer controlled disco dance floor, a custom Ford Mustang, t-shirt shooting robots and more.

Michael Crump works at Microsoft as a Product Manager on Windows and is a coder, blogger and speaker of various software development topics. He has a passion for a wide range of technology stacks that involve desktop and mobile. You can find Michael on twitter at @mbcrump or his personal blog at http://michaelcrump.net.

They are responsible for the new Windows Template Studio. In short, this is a set of templates to make creating UWP applications far easier.  WTS uses a wizard to walk you through four steps:

  • Pick your project type
  • Pick your Framework
  • Select which pages to use in your app
  • Add features

 

 

Posted in Essentials | Tagged | Leave a comment

Yet Another Podcast #169 – Shawn Wildermuth

Shawn Wildermuth has been tinkering with computers and software since he got a Vic-20 back in the early ‘80s. As a Microsoft MVP since 2003, he’s also involved with Microsoft as an ASP.NET Insider and ClientDev Insider. He’s the author of over twenty Pluralsight courses, written eight books, an international conference speaker, and one of the Wilder Minds. You can reach him at his blog at http://wildermuth.com.

 

Today we dive deep into ASP.NET Core, and then talk about Shawn’s upcoming documentary on why developers are passionate about what they do.

 

Posted in ASP.NET Core | Tagged | 2 Comments

C# 7 First Look

Very proud to announce the release of my newest Pluralsight course:  C# 7 First Look.

Posted in C#, Pluralsight, Programming | 2 Comments

File Persistence in Xamarin.Forms Apps

The goal is to persist data to a file.  You might do this for any number of reasons, including storing away user-preferences or, in this case, storing away data to protect you from a crash.

In this simple application we collect names and display them in a list.  If the program crashes after the names are stored to disk, clicking restore will bring them back.

To do this we’re going to create a generic file repository.  This is overkill for this simple demo example, but can be a very powerful pattern to use with larger applications.

Continue reading

Posted in Essentials, Patterns & Skills, Programming, Xamarin | Leave a comment