Matching UIKeyboard speed and curve to your animation

|

I have a ViewController in my Xamarin.iOS application, where i scale the View Frame when the keyboard shows. However, I had some trouble with matching the speed and curve of the animation to the keyboards animation. Though I found a pretty good solution, which takes the values from the keyboard itself, through the UIKeyboardWillShowNotification.

Disabling ActionBar menu items

|
I have some use cases where I want to temporarily disable ActionBar menu items, such that they are not clickable, but also so they are a different color from the active ones. The default SetEnabled method on IMenuItem does not do this for you. Sure it disables the item, however the visual state does not change. Hence, I found a nifty way to change this and made my own SetEnabled extension method.

Using this extension method can grey out menu items, so they appear disabled from a UX perspective. The method takes some more parameters, as it needs to get the resource id of the Drawable you want to use for the greyed out item and the current Context, such that it can get it from the application resources.

Getting Support V7 working with MvvmCross

|
Recently Xamarin added Support V7 AppCompat and GridView to their Component store, which you now can use instead of ActionBarSherlock or LegacyBar and it is Google's official way to support ActionBar's on API's which natively do not support it. However it does not work straight out of the box and you need to mimic what MvxActivity does in your own implementation. So here's the code I used to re-create MvxActivity to inherit from ActionBarActivity instead of Activity, which Support V7 needs.

This way you only need to replace MvxActivity with MvxActionBarActivity where needed and also add one of the AppCompat Themes to your Activity: Theme = "@style/Theme.AppCompat.Light"

Xamarin officially announced PCL support and more...

|
It has been a little while since last update from me. Since then a lot of stuff has happened in the Xamarin world. They have teamed up with Microsoft and released official PCL support, while Microsoft has loosened up their licenses on Bcl and their HttpClient among others. This is really great news!

I have already heard about people releasing their libraries for Xamarin because of the PCL support, among them is Jon Skeet, which is working with his team on Noda Time. There was some questions about what is actually supported in the various profiles, and I have spent the day today to track that down and test various PCL's. For now I have only tested for async/await and Tasks support and which profile supports which targets and contains which subsets.

This can be seen in the table below or by visiting my Google Spreadsheet I have made with it.



From what I can see the best choice for a profile to pick in your project seems to be either profile 78 or 158. The former is reported to not have Timer and ThreadPool in it and if you need support for Silverlight 5, profile 158 seems to be the best choice overall.

Generating QR Code using Google Charts API in C#

|
We are playing with QR Codes at work and needed a quick and simple way to generate QR Codes. I discovered the Google Charts API has a hidden way to generate these. This lead me to make a quick small LinqPad script to generate these. Find it here or see below.