Advanced Databinding Part 2: Converters

En Español

There are times when you need to bind to a source but the source is not in the right format or otherwise needs to be manipulated.

For example, suppose, as we’ll show below, that you have a text entry and a button, but you only want the button enabled as long as there are one or more characters in the text entry, and of course if there is no text entered you want to disable button.

You could bind the button to a boolean property in your View Model and bind the text to another property and then on text changed you could test to see if there is text in the entry control and update the button.  Yuck.

Continue reading
Posted in Essentials | Comments Off on Advanced Databinding Part 2: Converters

Advanced Data Binding Part 1

This is the first in a series on advanced data binding. In this series we will look at: using value converters with binding, relative binding, the {Binding .} and {Binding self} constructs, and more.

We hope to release one of these every week or two. 

Getting Started

We will be posting Part 0 shortly.

Samples

For each topic we discuss, we will provide a simple sample (as simple as possible but no simpler) which we’ll put up on Github and we’ll provide the URL in the blog post. We will walk through that sample to eliminate any confusion and to drive home what we’ve said about the topic.

Some of the samples we’ll make up for this series, others we’ll steal from the Microsoft documents. Which reminds me, why would you read this instead of the official documents? The answer, for me, is that the Microsoft documents are very thorough, but sometimes that can be overwhelming. Most important, however is that triangulating from multiple sources can help zero in on a full understanding.

Topic #1: Paths

The use of the path keyword is a good, intermediate place to start. It can be used in a number of ways. The most frequent is either to point to a property of an object held in a resource, or to point to a property of a property.

 

Continue reading
Posted in Advanced Data Binding, Essentials, Xamarin.Forms | Comments Off on Advanced Data Binding Part 1

The Miracle of IQueryAttributable

This knocked me out. Let’s say you have a value in one view model, and when you navigate to another page you want that value in the new page’s view model. Enter IQueryAttributable. (tough to say, even tougher to spell)

I have created a simple example. We’re going to start with an out of the box Xamarin.Forms project. As part of that we’ll get an AboutPage. At the bottom of the about page I’m going to add a button:

<Button Text="ShowId" Command="{Binding ShowIdCommand}" />

Nothing surprising here. Let’s follow that ShowIdCommand. For that we turn to the associated view model (also out of the box)

Continue reading
Posted in Essentials | 1 Comment

Lance McCarthy

Lance McCarthy talking about Maui, VS2022, community contributions and much more.

Referenced sites and source:

Resource 1 – CommonHelpers

That is the CommonHelpers NuGet package I was referring to. It not only is a good helper in a .NET project, but you can also look at it’s GitHub Actions to see how to automatically built, test and publish  to NuGet.

Resource 2 – DevOpsExamples

That repo shows you how to build WPFASP.NET CoreWinFormsConsoleXamarin.Forms, .NET MAUIAngularReact and Vue projects in GitHub ActionsAzure DevOpsGitLab CI and AppCenter (see the build status badges here).

The workflows can be found here https://github.com/LanceMcCarthy/DevOpsExamples/tree/main/.github/workflows

Resource 3 – MediaFileManager a real-world CI-CD example for WPF

This repo is for MediaFileManager, one of my real-world WPF apps that is published to the Microsoft Store. It shows you how to use GitHub Actions to automatically build MSIX packages and publish to the Microsoft Store.

Not only does it build and upload to the Store, but I also show how to build an msixbundle with an appinstaller file that gets uploaded to Azure Blob Storage so you can host your own mini-Microsoft Store for your non-Store users. Check out the mini-store page here Media File Manager (windows.net)

Resource 4 (bonus) – AI Powered Toilet Flusher for my Cat

I built a full system that uses AI, SignalR, Windows IoT, and Xamarin.Forms to automatically flush the human toilet when my cat uses it. You can see the companion blog post here Using Windows IoT, SignalR, Azure Custom Vision and Xamarin Forms to Flush a Toilet – DVLUP

Posted in .Net 6, Essentials | Tagged | Comments Off on Lance McCarthy

Visual Studio 2022!!

Mads Kristensen talks about all the goodness in Visual Studio 2022

Posted in Essentials | Tagged | Comments Off on Visual Studio 2022!!

A Dozen Utilities I Use Every Day

Here are 12 utilities I use every day. They are in no particular order. I spend most of my day programming in Visual Studio 2019.

#0 – Resharper. I’m so ambivalent about this add on for Visual Studio. On the one hand it has some fantastic features for a serious programmer. On the other hand, it is a beast and can significantly slow both loading VS and building your app. I’ve loaded it and removed it a number of times. On balance, it is a killer utility.

Continue reading
Posted in Essentials | Comments Off on A Dozen Utilities I Use Every Day

Get Git in 45 Minutes

Presentation to the St. Pete’s user group

Posted in Essentials | Comments Off on Get Git in 45 Minutes

Mads Torgersen On C# 10

Mads comes back on show 200 (!) to talk about all things C# 10, which will be released November 2021.

Posted in C#, C# 10, Essentials, Languages, Podcast | Tagged | Comments Off on Mads Torgersen On C# 10

Tables Turned II – Unhandled Exception Podcast

Dan Clarke interviewed James World and me about Git and my new book, Git For Programmers. The podcast is here.

Posted in Essentials | Comments Off on Tables Turned II – Unhandled Exception Podcast

Git! Turn the tables

In this podcast the tables are turned, and I’m interviewed by Kate Strachni of Datacated

.

Posted in Essentials | Tagged | Comments Off on Git! Turn the tables

Don’t Miss Mads Torgersen on C# 8 and 9

A few weeks back we had Mads Torgersen on Yet Another Podcast. It is too good and too important to miss.

Posted in Essentials | Tagged | Comments Off on Don’t Miss Mads Torgersen on C# 8 and 9

Interactive Rebase

Following along from my previous blog post on rebasing, this post will cover interactive rebasing.

The first thing to know about interactive rebasing is that as far as the programmer is concerned it has nothing to do with rebasing. The principal purpose of Interactive Rebase is to clean up your commits before you push them to the server.

To see this at work, let’s create the world’s dumbest C# program. For this purpose I assume you have git installed along with Visual Studio 2019 and that you have an account on GitHub. If not, they are all free, so go get ’em and I’ll wait here.

All set? OK, let’s create a C# Console app called dumbApp on GitHub

Continue reading
Posted in Essentials | Comments Off on Interactive Rebase