This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
// from Xamarin Monkey demo - http://motzcod.es/post/93792500152/custom-listview-viewcells-in-xamarin-forms | |
namespace Interact.Core.Helper { | |
public class Grouping<TKey, TValue> : ObservableCollection<TValue> { | |
public TKey Key { get; private set; } | |
public Grouping(TKey key, IEnumerable<TValue> items) { | |
Key = key; | |
foreach (var item in items) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Xamarin Evolve 2014: Extending Xamarin.Forms with Custom Controls - Jason Smith, Xamarin https://www.youtube.com/watch?v=pIZ8G47KPIM | |
protected async override void OnAppearing() { | |
base.OnAppearing(); | |
var loadingView = new ActivityIndicator { | |
VerticalOptions = LayoutOptions.Center, | |
HorizontalOptions = LayoutOptions.Center, | |
IsRunning = true | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://developer.xamarin.com/recipes/ios/content_controls/map_view/display_a_location/ | |
/// <summary>Converts miles to latitude degrees</summary> | |
public static double MilesToLatitudeDegrees(double miles) { | |
double earthRadius = 3960.0; // in miles | |
double radiansToDegrees = 180.0 / Math.PI; | |
return (miles / earthRadius) * radiansToDegrees; | |
} | |
/// <summary>Converts miles to longitudinal degrees at a specified latitude</summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://social.msdn.microsoft.com/forums/windowsapps/en-us/b639cd8a-30c2-48cf-99be-559f34cbfa79/convert-string-to-color-in-metro | |
public static System.Windows.Media.Color GetColorFromHexString(string hexValue) { | |
hexValue = hexValue.Substring(1, 6); // string will be passed in with a leading # | |
byte a = 0xff;// Convert.ToByte(hexValue.Substring(0, 2), 16); | |
var r = Convert.ToByte(hexValue.Substring(0, 2), 16); | |
var g = Convert.ToByte(hexValue.Substring(2, 2), 16); | |
var b = Convert.ToByte(hexValue.Substring(4, 2), 16); | |
return System.Windows.Media.Color.FromArgb(a, r, g, b); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/10310917/uicolor-from-hex-in-monotouch | |
public static UIColor GetColorFromHexString(string hexValue) { | |
hexValue = hexValue.Substring(1, 6); // string will be passed in with a leading # | |
var r = Convert.ToByte(hexValue.Substring(0, 2), 16); | |
var g = Convert.ToByte(hexValue.Substring(2, 2), 16); | |
var b = Convert.ToByte(hexValue.Substring(4, 2), 16); | |
return UIColor.FromRGB(r, g, b); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "return" "version" "name" - names aren't syntactically correct (they're probably upper case for starters) | |
// 21 5.0 lollipop | |
// 20 4.4.2W kitkat wear | |
// 19 4.4.2 kitkat | |
// 18 4.3.1 jelly bean mr2 | |
// 17 4.2.2 jelly bean mr1 | |
// 16 4.1.2 jelly bean | |
// 15 4.0.3 ice-cream sandwich mr1 | |
// 14 4.0 ice-cream sandwich | |
// 13 3.2 honeycomb mr2 |
NewerOlder