Posts

Edit or clear the recent projects and files in Visual Studio 2019

Image
I've recently experienced an weird issue with Visual Studio 2019. The start dialog where you select the projects to open, froze for few seconds every time I opened Visual Studio.

I was able to find a workaround, by peeking under the hood of how Visual Studio 2019 keeps the recent project list stored.

So here we go:

VS 2019 keeps an XML with settings in the following location:

%LocalAppData%\Microsoft\VisualStudio\16.0_50e1ff9d

Note 16.0_50e1ff9d is the current Visual Studio version.

Within the XML file, the following node contains a JSON with an array of items, where each item is a description of a recent project you opened:
collectionname="CodeContainers.Offline"> <valuename="value">JSON with recent list of projects</value>

Here's an example of an item structure in the JSON:




IconFont2Code, my open-source tool in order to view icons in font files and create C# class with the glyph constants

Image
As an app developer, it's impossible not to have the task to display an icon in the app. One of the common ways to display icons, instead of using images or SVGs, is by using font files (.ttf, .otf or .woff).

Although font files are usually used to display text with a specific font, but they can also be used to display icons. Instead of containing glyphs with letters, they contain glyphs with icons:


There are different types of font technologies but the most common ones today are the TrueType (.ttf), OpenType (.otf) or the WOFF (.woff) font files. The way they store and render the glyphs is using a collection of line and curve commands as well as a collection of hint, which allows them to provide both relatively fast drawing speed and true device independence.

The device independence is a key aspect given the myriad of display sizes and technologies which exist today.

Referring to an icon inside of a icon font file works by knowing the hexadecimal value of glyph with that icon. T…

Xamarin Forms: Embedding native controls and still have XAML compilation for the Page

Image
Embedding native controlsSkip this part if you know what the embedding native controls is

In Xamarin Forms, with native control embedding, you can put native controls (i.e. native Android or iOS controls) on your Xamarin Forms pages. It’s very simple and the official Xamarin Forms documentation (link here) explains how to achieve it. Here’s an example of using native embedding in XAML:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:ios="clr-namespace:UIKit;assembly=Xamarin.iOS;targetPlatform=iOS"
        xmlns:androidWidget="clr-namespace:Android.Widget;assembly=Mono.Android;targetPlatform=Android"
        xmlns:androidLocal="clr-namespace:MyApp.Droid;assembly=MyApp.Droid;targetPlatform=Android"
        x:Class="MyApp.MyContentPage">     
        …
<ios:UILabel Text="Hello World" TextColor="{x:Static ios:UIColor.Red}" View.…

Xamarin.Forms XmlnsDefinition attribute: All of your namespaces become one

Image
When working on a mobile app developed with Xamarin Forms (if  you aren’t, you’re missing all the fun!) you might have your own awesome separate library projectof custom controls, effects, behaviors, value-converters, constants:



You’ve might not been very happy (to put it nicely) how you're using your library objects in your app’s XAML, having to deal with all the different XML namespaces and prefixes:


So many prefixes and namespaces to handle! Yikes!

The issue is not just about declaration of prefixes. Having separate prefixes bloats the XAML a lot because you have to use a separate prefix for every object you reference from the corresponding namespace. In my example there are 4 prefixes to deal with!

As a solution to get rid of all the namespaces, a dark thought might have crossed your mind: remove all the CLR namespaces in the library’s code and just have one namespace! But you love your C# namespaces, they give class scope and separation, it’s something you just can’t live wit…

Bindable layouts, one of my contributions to the Xamarin.Forms framework

Image
Xamarin, Microsoft-owned for few years now, asked me to write on their blog a guest post about bindable layouts, one of my contributions to the Xamarin Forms framework, an awesome open-source cross-platform framework for developing mobile apps.

After finishing the implementation, I submitted a pull-request for it and, lo and behold, the Xamarin.Forms team accepted it! Contributing to a large framework as Xamarin.Forms can take lot of blood and sweat sometimes but it’s a lot of fun.

Here’s the blog post I wrote on Xamarin's blog which describes the bindable layouts feature:
https://blog.xamarin.com/xamarin-forms-3-5-a-little-bindable-love/

...just posted on the Xamarin Blog, Andrei Nitescu shares one of his contributions to Xamarin.Forms, the bindable layout. Starting with Xamarin.Forms 3.5.0 pre2, we can use the BindableLayout set of attached properties on any Layout<T> view. Learn more: https://t.co/zhLzBKRWPapic.twitter.com/hVtVjjqN20 — Xamarin (@xamarinhq) January 11, 2019

Xamarin Forms: Lazy load the tabs in TabbedPage

Too much fun with Xamarin Forms

Image
I had a blast playing with Xamarin Forms and SVGs which end up with the following which works on iOS, Android and Windows UWP, checkout the videos for Android and iOS apps:



Credit for original design idea goes to Mikael Ainalem: https://twitter.com/mikaelainalem/status/963076814183772160
The SVG is created dynamically, based on the position of the text-boxes and the button, so it will work on any number of text-boxes and buttons. The actual SVG for the login screen in the videos, looks like this: