Lunedì 9 maggio ho avuto il grandissimo onore di partecipare come speaker ad un evento di portata nazionale come #NuvolaRosa, un evento organizzato con l’obiettivo di coinvolgere le ragazze in quelle che sono le evoluzioni, o rivoluzioni, in atto nel mondo del lavoro, soprattutto in ambito tecnologico.

L’evento ha visto la partecipazione di oltre 800 ragazze, studentesse di scuola superiore e universitarie, coinvolte tra corsi, talk e hackaton in una due giorni senza sosta presso il Politecnico di Bari.

nuvola_rosa_4

E’ stata un’esperienza particolare e davvero unica, soprattutto nel vedere così tante ragazze appassionate di tecnologia ed incuriosite sui possibili risvolti che può avere nel mondo lavorativo. Io ho avuto il piacere di tenere due seminari in cui si è parlato di Microsoft Azure e del Cloud Computing che, mentre per alcune di loro era già ben noto, per altre è stata una piacevole sorpresa. E’ stato inoltre molto piacevole raccogliere interessanti feedback dopo aver tenuto le sessioni e sapere che quanto detto è stato recepito e soprattutto è andato a riempire un bagaglio di conoscenze prezioso per il loro futuro.

Un ringraziamento particolare va a tutto lo staff di NuvolaRosa per l’organizzazione e la passione in una manifestazione così ampia ed importante. Non è mai semplice, gli ostacoli sono tanti, ma credo che l’ottimo risultato ripaga ampiamente l’impegno profuso.

Al prossimo anno!

nuvola_rosa_3 nuvola_rosa_2 nuvola_rosa_1

Read more

MVP_Logo_Preferred_Cyan300_RGB_300ppiI’m very excited to be awarded as MVP for the seventh year in a row! Great! I would like to say thanks to all my friends and members of the DotNetSide user group that support me with great passion and enthusiasm!

Also thanks to Microsoft, in the person of Christina and Marjorie, and to all MVPs, a big family that loves share its passion for technology.

So, I’m now ready for a great new year. Microsoft made a big step forward embracing the open source world. We’ll see what happens!

 

Read more

Xamarin.Forms provides the ability to create easy and wonderful views animations with few lines of code. For example, if you need to rotate a View, you can simple set the Rotation property, like this:

Device.StartTimer (TimeSpan.FromMilliseconds (100), () => {
    this.Ball.Rotation+=1;
    return true;
});

So, you can get this effect:

RotatingImage

Enjoy!

Read more

In one project I was working on, a page needs to show a short horizontal and scrollable list of items (something like the Apple App Store app). Xamarin.Forms offers the ability to use a ScrollView control to show a list of items horizontally but, in my case, the items I must to show comes from a dinamically populated list.  In that case I’ve extended the ScrollView control and added the ItemsSource and ItemTemplate property.

public class TLScrollView : ScrollView
{
	public static readonly BindableProperty ItemsSourceProperty =
		BindableProperty.Create("ItemsSource", typeof(IEnumerable), typeof(TLScrollView), default(IEnumerable));

	public IEnumerable ItemsSource
	{
		get { return (IEnumerable)GetValue(ItemsSourceProperty); }
		set { SetValue(ItemsSourceProperty, value); }
	}

	public static readonly BindableProperty ItemTemplateProperty =
		BindableProperty.Create("ItemTemplate", typeof(DataTemplate), typeof(TLScrollView), default(DataTemplate));

	public DataTemplate ItemTemplate
	{
		get { return (DataTemplate)GetValue(ItemTemplateProperty); }
		set { SetValue(ItemTemplateProperty, value); }
	}
}

After that, I’ve added a simple method, Render, to populate the ScrollView:

public void Render ()
{
	if (this.ItemTemplate == null || this.ItemsSource == null)
		return;
	
	var layout = new StackLayout ();
	layout.Orientation = this.Orientation == ScrollOrientation.Vertical 
		? StackOrientation.Vertical : StackOrientation.Horizontal;

	foreach (var item in this.ItemsSource) {
		var viewCell = this.ItemTemplate.CreateContent () as ViewCell;
		viewCell.View.BindingContext = item;
		layout.Children.Add (viewCell.View);
	}

	this.Content = layout;
}

That method will be called from the TLScrollViewRenderer (iOS and Android are pretty similar). The renderer is a special class that adapts the Xamarin.Forms control into a native control:

[assembly: ExportRenderer(typeof(TLScrollView), typeof(TLScrollViewRenderer))]

namespace TitiusLabs.Forms.iOS.Controls
{
	public class TLScrollViewRenderer : ScrollViewRenderer
	{
		protected override void OnElementChanged(VisualElementChangedEventArgs e)
		{
			base.OnElementChanged(e);

			var element = e.NewElement as TLScrollView;
			element?.Render();
		}
	}
}

Now you can use the TLScrollView in your xaml and create your custom template in this way:

<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:controls="clr-namespace:TitiusLabs.Forms.Controls;assembly=TitiusLabs.Forms" xmlns:local="clr-namespace:FormSamples" x:Class="FormSamples.Core.Views.FormSamplesPage">
	<StackLayout Padding="20">
		<controls:TLScrollView Orientation="Horizontal" ItemsSource="{Binding Items}" HeightRequest="100">
			<controls:TLScrollView.ItemTemplate>
				<DataTemplate>
					<ViewCell>
						<StackLayout Padding="5">
							<controls:TLImageCircle Source="{Binding Image}" HeightRequest="80" WidthRequest="80" />
						</StackLayout>
					</ViewCell>
				</DataTemplate>
			</controls:TLScrollView.ItemTemplate>
		</controls:TLScrollView>
	</StackLayout>
</ContentPage>

This is the final result:

Amazing!

UPDATE 12.04.2016: some small refactoring to the custom horizontal ScrollView control

Full code is available here

 

Read more

Why software error or anomaly is called “bug”?

One of the first big calculator, the Mark II, suddenly stopped to work during one night. Engineers, as they tried the problem, they found a moth (bug) trapped in a relay.

This was the “first case of bug being found”.

Starting from that event, the act of looking for a bug was called “debugging”, that means “pest control”.

Nice story 🙂

Read more

This is the first post about the new features included in Xamarin.Forms 2.0, released with Xamarin 4 a week ago.

In the previous versions of Xamarin.Forms when you made some mistakes in XAML, like a wrong property or a wrong value, you can’t catch the error until start a new debug session. Xamarin.Forms 2.0 adds a new attribute that allows checking XAML at compile-time. You have only add that code in the AssemblyInfo.cs file:

using Xamarin.Forms.Xaml;
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]

Now you got a compile-time error in case of wrong XAML:

Schermata 2015-12-08 alle 08.47.19

XamlCompilation and Xamarin.Forms performance

The compile-time xaml check is not the only benefit of XamlCompilation. Precompiled XAML will produce a smaller app file, since the XAMLs are no more embedded, and thus a much more fast app by removing the XAML load time.

Amazing!

Read more

In my talks, speaking about Xamarin.Forms, the most common question is: “Wonderful technology! But … when Xamarin.Forms is the preferred choice? Why (and when) I should use it instead of native apps?”

My answer: “It depends!”

Xamarin.Forms is really a great and fast way to develop mobile apps by abstracting controls in XAML, a simple description on what we want to do. That controls are then “magically rendered” in native controls. With this in mind, it’s impossible to abstract all the things completely, so sometimes it’s necessary to extend the framework with custom renderers. This means that you must know the target OS environment. No way.

In his post “How to success with Xamarin Forms”, Daniel Hindrikes says that you must don’t care if your app “doesn’t look perfect from the beginning. When you have created your app and built all the business logic, then you can start to look at how to make the app perfect.”. While I totally agree with him, I would add another step: after building all the business logic and the first UI version, evaluate if Xamarin.Forms is the right the framework for your app.

 

Read more