Slides and sample code for #XamarinEvolve and #Techorama

.NET, MVVM, Techorama, WPF, Xamarin, XAML
4 Comments

These past weeks have been busy with travel and speaking. After the wonderful time in San Francisco for Build 2016, I had a few precious weeks to prepare for Xamarin Evolve (Orlando, FL) and Techorama (Mechelen, Belgium). I just came back and here is the time to post the slides, sample code, and for Xamarin Evolve we even have a video of the talk!

Xamarin Evolve

2016-01-03_19-25-58

Evolve took place in tropical Orlando, and it was pretty nice to see sun, warm temperature and even some pool time on the day after the conference ended. I had a great time there. I talked about the DataBinding system in MVVM Light, which applies to Xamarin.iOS and Xamarin.Android. This critical part of all MVVM applications is there to ensure the connection between the ViewModel layer (typically in a portable class library and shared across all platforms) and the View layer. In Xamarin.Forms and on Windows, we don’t need an external databinding framework because we already have these (this is what you use when you write Text=”{Binding MyProperty}” in XAML). But in Android and iOS, there is no such concept, and this is where the MVVM Light platform-specific extensions come handy.

Here is the abstract (which was modified by Xamarin themselves… I normally don’t really use this marketing-y tone ;):

An In-Depth Study of the MVVM Light Databinding System

Living in the dark ages and still wiring up properties manually between your user interface and data source? Databinding is a technique to automatically synchronize a user interface with it’s data source and can vastly simplify how your app displays and interacts with data. While databinding is available out of the box for Xamarin.Forms and Windows applications, additional components are needed in Xamarin.Android and Xamarin.iOS. In this session, learn how to leverage databinding in your cross-platform applications as you master MVVM Light databinding and the MVVM pattern.

I created a page for this presentation on my website. There you will find the slides, video recording as well as the sample code.

Note: At the moment, some of the Xamarin Evolve videos are not working properly. Xamarin is informed. Thanks for your patience.

Techorama

techorama

Techorama is one of my favorite conferences, created by the community for the community after the cancellation of TechDays Belgium. Gill, Pieter and Kevin created a hell of a show, which grew to host more than 1000 visitors these days. The venue is awesome too, it is a movie theater and we get to project our slides and code on a huge screen. This year there were quite a few renowned speakers from the US and the whole world in fact. Even though I got to spend only one night at home after coming back from Orlando before flying again, which was quite tiring and a bit stressful, I was really looking forward to go to Mechelen. I hope you enjoyed my session there about WPF. It was a fun session where I talked about the differences between WPF and the Windows 10 Universal platform, about new development in WPF (especially tools such as the Visual Tree, the Live Property Explorer, and XAML Edit and Continue), about the Windows Bridge “Project Centennial” which takes a classic Windows app and “packs” it to transform it into a Universal application. We finished with an exciting demo of a new feature shown at Xamarin Evolve the week before: the Xamarin Workbooks, which allow you to create a rich document (using Markdown) with titles, subtitles, images etc, and allows including snippets of C# that will be executed by the Xamarin Inspector tool. Because the tool supports Android, iOS and WPF, it was a great find and it fitted well in my session which aimed to show that WPF is still very current and state of the art. So I happily changed my presentation to include it in the demos.

Windows Presentation Foundation (WPF) 4.6

Windows Presentation Foundation is what people are using to build real applications for the enterprise, the industry, the workplace, and for every situation where Windows 10 Universal is not quite ready yet. Far from being dead, WPF is 10 years old this year, alive and kicking, and gives Universal Applications a run for their money! In this session, Laurent Bugnion, a Microsoft Windows Developer MVP and Microsoft Regional Director, WPF expert since 2006, will show you what is new in Windows Presentation Foundation, where it is going in the future, and what you can achieve with WPF that Universal Application developers can only dream of.

The presentation’s page is on my website, and will give you access to the slides and the demo source code. Make sure to check the last couple of slides for more resources!

One more thing

I recently discovered (not sure how I missed that) that my session about Windows 10 UWP at the Future Decoded conference in London last year had been recorded. I added the video to the presentation’s page. So in case you want to know how to adapt your UWP app on multiple platforms, this is where you can go!

Happy coding!
Laurent

GalaSoft Laurent Bugnion
Laurent Bugnion (GalaSoft)
 

4 Responses to “Slides and sample code for #XamarinEvolve and #Techorama”

  1. Jesu Castillo Says:

    Hey, the link to the data binding presentation is broken, besides that, I did watch your evolve session, just one question regarding the ObservableRecyclerAdapter, i would like to bind the click to a command on my viewmodel, but i though of one way i think it might not be the right one, which is handling the onclickitem delegate and executing the command, passing the selecteditem, except, that this selecteditem is null unless i use the getitem method using the selecteditemposition property, in that case it works, any workaround or it’s like this how it should be done?

  2. lbugnion Says:

    Hi,

    Thanks for the feedback about the link, it is fixed now.

    About commanding: Right now it is more complicated than it should be and this is one of my priorities in V5.4 which I am already working on. I want to make it as easy to detach a Command than it is to detach a binding. So expect very similar code soon. As for now, the way you are suggesting seems the best way, even though it is way more complex that it should be. Not sure what Android engineers were thinking about honestly… Take care!

  3. Jesu Castillo Says:

    Well, thanks for the quick response, the way i did it it’s like this:

    private ObservableRecyclerAdapter _productAdapter;
    public ObservableRecyclerAdapter ProductAdapter
    {
    get
    {
    return _productAdapter
    ?? (_productAdapter = Vm.Products.GetRecyclerAdapter(
    BindViewHolder,
    Resource.Layout.list_item,
    OnItemClick));
    }
    }

    private void OnItemClick(int oldPosition, View oldView, int newPosition, View newView)
    {
    Vm.SelectedProduct = ProductAdapter.GetItem(newPosition);
    Vm.DescriptionCommand.Execute(null);
    }

    Since i couldn’t simply send the Adapter.SelectedItem, because it’s null when you reach the OnClickItem, in any case, thanks for your work Laurent, i trully love the way it helps me get cleaner code, except for this little android issues.

  4. Steven Says:

    Hi Laurent,

    I’ve reviewed your 2016 Evolve video and sample code project and have successfully implemented some of it (and your Pluralsight lectures) in a cross platform WPF-PCL-Xamarin.Android solution. While I have the recycler adapter code, I’m having issues trying to pull off the same sort of thing with Android spinners… I’m trying to data-bind it to an ObservableCollection list, as well as have the spinner’s selection two-way databound to a selectedItem string.

    In WPF, I have this working already with no code-behind :)

    Both the list and selectedItem are in the PCL, in a viewmodel, using your easy-to-use mvvminpc code snippet! Any help on the spinner?

Leave a Reply