-
Book Overview & Buying
-
Table Of Contents
Xamarin 4.x Cross-Platform Application Development - Third Edition
By :
When using shared projects, one of your most powerful tools is the use of preprocessor statements. If you are unfamiliar with them, C# has the ability to define preprocessor variables such as #define IPHONE, and then using #if IPHONE or #if !IPHONE.
The following is a simple example of using the technique:
#if IPHONE
Console.WriteLine("I am running on iOS");
#elif ANDROID
Console.WriteLine("I am running on Android");
#else
Console.WriteLine("I am running on ???");
#endif
In Xamarin Studio, you can define preprocessor variables in your project's options under Build | Compiler | Define Symbols, delimited with semicolons. These will be applied to the entire project. Be warned that you must set up these variables for each configuration setting in your solution (Debug and Release); it can be an easy step to miss. You can also define these variables at the top of any C# file by declaring #define IPHONE, but they will only...
Change the font size
Change margin width
Change background colour