James Montemagno on Maui!

I’m joined by James Montemagno, Principal Lead Program Manager for .NET Community at Microsoft, and the most enthusiastic person I know. James is the author of the .NET Presentations – .Net Maui In A Box, among many other things.

You can also listen to this wherever you get your Podcasts.

Note: My microphone was broken but I’ve edited most of my questions to the minimum and James sounds great. And, after all, it is James who you want to hear anyway!

Posted in Maui | Tagged | 1 Comment

.vsix with Mads Kristensen

.visx files are magic as far as I’m concerned. Mads takes us through their history and how they have become much easier to create.

 vsixcookbook.com

Yet Another Podcast is available wherever you get your podcasts.

Posted in Essentials, Visual Studio | Tagged | 1 Comment

Visual Studio Champ

Part 1 of Being a Visual Studio Champis now on video!

This is a 3 part conference streaming from Denmark and world-wide. vschamp.com

Do not miss the next one on Add-ons with (among others) Mads Kristensen. April 27, 10am Eastern.

vschamp.com

One of my secret wish items was the ability to set the background color differently for different projects so I always know where I am. The problem was that it tells you your project in the upper right, so I didn’t want to whine about it. Well guess what, I installed VS2022 Preview today and saw this:

Happy, happy, happy.

Awww snap! It works across projects (yay) but not across solutions (boo). Maybe next time.

Posted in Essentials | Comments Off on Visual Studio Champ

What I Want in Visual Studio 2022 That Isn’t There (updated)

I love Visual Studio 2022. I spend all my work day in it. It is by far the best IDE I’ve ever worked with. Each iteration gets better, with amazing features. But I’m greedy, so here are some features I want…

  • Save and name my entire working state (e.g., windows open, breakpoints, bookmarks, etc.) Then if I have to switch to another branch I can come back, drop down a list of saved working states, select the one I just saved and get back to work.
  • Switch to make the default for C# classes public (rather than internal)
  • News Flash! Mads Kristenson’s Tweaks2022 let’s you create new files with Shift-F2 and the .cs files are born public!!
  • During debug of a Xamarin.Forms app, take some action (tbd) to find out what Xaml file you are looking at
  • Of course, a visual designer for Xamarin.Forms (Blend?) – Layout, visual states, animation

Send me more! jesseliberty@gmail.com

Posted in Opinion, Visual Studio | Comments Off on What I Want in Visual Studio 2022 That Isn’t There (updated)

Jon Galloway – Yet Another Podcast

Jon Galloway comes on Yet Another Podcast to talk about… well, a lot of stuff.

Posted in Essentials | Tagged | Comments Off on Jon Galloway – Yet Another Podcast

Advanced Databinding Part 4 – Binding .

In this post we will examine one of the aspects of advanced databinding that many people find confusing. Binding . (that is, Binding dot). However, it is surprisingly easy to explain.

Binding . allows you to access the entire binding context.

This is best understood with an example

<StackLayout BindingContext="{x:Static sys:DateTime.Now}"
                 HorizontalOptions="Center"
                 VerticalOptions="Center">

            <Label Text="{Binding Year, StringFormat='The year is {0}'}" />
            <Label Text="{Binding StringFormat='The month is {0:MMMM}'}" />
            <Label Text="{Binding Day, StringFormat='The day is {0}'}" />
            <Label Text="{Binding StringFormat='The time is {0:T}'}" />
            <Label Text="{Binding ., StringFormat='The full date is {0}'}" />
            <Label Text="{Binding}" />

        </StackLayout>

Here the stacklayout sets its BindingContext to DateTime.Now. That will allow us to bind to properties of the DateTime object that has the current local time. The first few lines are straight forward, we bind to properties of the DateTime object. For example,

Continue reading
Posted in Essentials | Comments Off on Advanced Databinding Part 4 – Binding .

C# 10 & Documentation: Bill Wagner

Bill Wagner joins us once again, this time to talk about C# 10 and the evolving Microsoft. documentation.

Check back here for links but I just couldn’t wait to publish this.

Posted in Essentials | Tagged | Comments Off on C# 10 & Documentation: Bill Wagner

Advanced Databinding Part 3 – Null or Missing Values

You want to bind to a collection of values and display each in turn, but it is possible that some of the objects in the list have null properties, or some properties are missing altogether.

You can handle this with value converters, but there is a better (easier to write, easier to understand when reviewing) way.

In your Xaml, if you suspect a value may be null, you can makr it TargetNullValue and give it a string to display

TargetNullValue='Age unknown'

Similarly, if the value may be missing you can provide a default value,

FallbackValue='No School Found'

In this posting we’ll show how to use both.

Continue reading
Posted in Essentials | Comments Off on Advanced Databinding Part 3 – Null or Missing Values

Advanced Databinding: Part 0 – BASICS

In the ugly old days, if you had data that you wanted to display you would put the data into a variable and then write some code to copy that data to a control on your page. If the data changed, your code had to update the display. If you had a list of data, you had a bit of code to write to get each item in the list displayed in turn.

Xamarin.Forms provides Databinding to do all that work for you. Essentially you say “here’s my data and I want it in this UI element over here. If the data changes, update the display for me.” Even better you can say “here is a collection of objects, and here is how I want you to display properties from each one in turn and if something is added to or taken from the collection, adjust the list accordingly.

“Databinding” is well named: you bind your data to a control, and as the data changes, that change is reflected in the control.

Continue reading
Posted in Essentials | Tagged , , | Comments Off on Advanced Databinding: Part 0 – BASICS

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