Don of the Day

Don of the Day


Adventures in software development with Xamarin and the Web

Software developer, building things with code in sunny Scottsdale, AZ.

Share


Twitter


How I Setup Xamarin Studio

Don FitzsimmonsDon Fitzsimmons

In my last blog post, I discussed why using Xamarin Studio on the Mac is a good idea. In short, the development experience is much faster using Xamarin Studio than it is if you choose to write apps with Visual Studio. The compile -> deploy -> test cycle is so much faster and when writing apps and you'll do this a lot, possibly hundreds of times a day.

If you're coming from a development environment where Visual Studio is the standard, and most C# developers are, Xamarin Studio will take some getting used to. It's different. But, with a little tweaking and time, I found it easy to get used to and now I really like it. Let's discuss some of the things I do to make Xamarin Studio feel more like home.

UI Layout

The first thing you'll notice when you open Xamarin Studio for the first time is that the solution explorer is on the wrong side. In Visual Studio it's on the right side. In Xamarin Studio, it's on the left. Most text editors (Atom, Sublime, VS Code) default to this left side orientation. Visual Studio is actually one of the few IDE's to put the file explorer on the right.

Left side orientation of solution explorer in Xamarin Studio

The good news is that moving the solution explorer to its familiar place on the right is as easy as dragging and dropping it to the other side, much like you would with Visual Studio. Just put your pointer over the heading of the pad (Xamarin Studio calls these panes "pads") and drag it. You'll get a highlighted area where the pad can be dropped.

Just remember, when you start debugging, the solution explorer will again default to the left side. You have to also drag it to the right while debugging to get it to stay there in debug mode.

Visual Style

You'll notice from the screenshot above that Xamarin Studio looks really dark. That's an option. I personally prefer the dark UI, but the default is a light theme. To switch between the dark and light themes, simply do so in the preference pane under visual style.

The dark theme is fairly new to Xamarin Studio. The only option in the past was the light theme and the icons used be really dated and primitive looking. As of Xamarin Studio 6, the UI was overhauled and looks much more modern.

Syntax Highlighting

This is an area where I'm very picky. I like a nice dark surface for writing code and I want my syntax highlighting to make sense. Whether you like dark or light backgrounds, Xamarin Studio has several out of the box color schemes that are pretty nice.

Monokai in Xamarin Studio

If you're not happy with the color schemes included with Xamarin Studio you can either make your own, or grab one from Studio Styles and import it into Xamarin Studio's syntax highlighting dialog. Never mind. Apparently importing Visual Studio styles no longer works as it once did.

Optimal Fonts

My go-to font for the longest time has be Consolas. It's a great looking font and I still switch back to it occasionally. Lately though, my font of choice is called Inconsolata. It's just a gorgeous font and when you stare at text all day, good typography goes a long way.


A closer look at Inconsolata

If you like the look of this font, you can find it here. I can't remember what font Xamarin Studio defaults to but I think it's some plain old monospaced font, which oddly feels faster when typing (I wrote about that here), but I'll take the look of my current font over the perceived performance of a crappier looking font any day.

Code Formatting

This threw me off at first. The default code formatting in Xamarin Studio follows the Mono style, which means strange things like curly braces on the same line as a method definition. I don't mind that for JavaScript, but when I write C#, I want my curly braces on a separate line. Thankfully, you can easily change this setting and use the included Visual Studio style of code formatting, which will feel much more familiar.

Another annoyance in Xamarin Studio is the way namespaces are handled. Normally, in Visual Studio, you would create a directory for something like your service classes. When creating a new service class, you would right click the folder, create the service class and it's namespace would be your root namespace, a dot and the folder name. Something like: F3.DownToZero.Services.

Xamarin Studio does not behave this way by default. Instead, it just uses your root namespace everywhere. This is okay, but I like to use more granular namespaces for various reasons and it's what I'm used to. To fix it, you'll use the confusing dialog below to change the default behavior to associate namespaces with directory names.

Just select the first two check boxes and Xamarin Studio will create sub-directory namespaces just like you're used to in Visual Studio.

Using the Designer

Xamarin Studio includes designers for building your user interfaces in iOS and Android. I haven't used the Android designer yet, but I'm sure I will in the near future. As for the iOS designer, I just don't use it at all. It's buggy and I can never seem to get Apple's horrible auto layout system working in the Xamarin Designer.

Instead, I do all of my storyboard layouts in Apple's Interface Builder. It's really easy to use and it's well integrated with Xamarin Studio. Just right click your storyboard from Xamarin Studio and select "Open with Interface Builder". The changes you make in IB will be synced with your Xamarin Studio solution. I find this workflow clunky but more effective than trying to get the Xamarin Studio designer to play nice.

Conclusion

There you have it. These are things I do when setting up Xamarin Studio. Most of it is subjective stuff, but once I figured out how to make Xamarin Studio my own, I really started to like using it and now it feels like home.

You can find all sorts of information an Xamarin Studio by reading the Xamarin Studio Guide.

Software developer, building things with code in sunny Scottsdale, AZ.

Comments