Useful snippets for XF development [PART 1]
What are code snippets?
Code snippets are small blocks of reusable code that can be inserted in a code file by using command ( + TAB to generate code ) .
They typically contain commonly used code , to reduce coding/remembering time.They can be used to insert small block but complete class or complex xaml block too.
How to install a snippet in Visual Studio 2019 ?
I agree with you madam.
Open Visual Studio then open Tools => Code Snippet Manager ( or Ctrl+K Ctrl+B )

Press import , pick all your .snippet and voilà 🇫🇷 !
oh ? You don’t have any ? No problem !
My Code snippets
Let’s take a look at useful Code snippets
DataTemplateSelector snippet , not the most used, but we have to start somewhere.
//dts + TAB =<!-- wp:paragraph --> public class MySelector : Xamarin.Forms.DataTemplateSelector { protected override DataTemplate OnSelectTemplate(object item, BindableObject container) { return null; } }
ValueConverter snippet. 3 letters vs This 👇 ? Who have enough time to write converters structure code ? 😀
//cvt + TAB = public class MyConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { return null; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return null; } }
Shell Navigation by route name snippet , used lot of time ! That’s a time saver !
//sgta + TAB = await Shell.Current.GoToAsync("MyRouteName");
Command snippet , a must have if you work with MVVM !
//cmd + TAB = public Command MyCommand => new Command(() => { });
More Snippet More time saved !
You can easily extend your library with useful snippets !
Part 1 focused on C# Snippets
Part 2 will present you some XAML Snippets !

One thought on “Useful snippets for XF development [PART 1]”