Posts

Showing posts from 2019

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 val...

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

Image
Embedding native controls Skip 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 " >            ...

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 project   of 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...

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/zhLzBKRWPa pic.twitter.com/hVtVjjqN20 — Xamarin (@xamarinhq)...

Xamarin Forms: Lazy load the tabs in TabbedPage