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://forums.xamarin.com/discussion/comment/144204/#Comment_144204 | |
// Projects is an ObservableCollection | |
<ListView x:Name="projectListView" | |
ItemsSource="{Binding Projects}" | |
SelectedItem="{Binding SelectedProject, Mode=TwoWay}"> | |
<ListView.ItemTemplate> | |
<DataTemplate> | |
<TextCell x:Name="textCell" | |
Text="{Binding Name}" |
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; | |
using AltBeaconOrg.BoundBeacon; | |
using AltBeaconOrg.BoundBeacon.Powersave; | |
using AltBeaconOrg.BoundBeacon.Startup; | |
using Android.App; | |
using Android.Runtime; | |
namespace CustomApp.Droid | |
{ | |
[Application] |
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; | |
using System.ComponentModel; | |
using CoreGraphics; | |
using CustomRendererTest.Controls; | |
using CustomRendererTest.iOS.Renderers; | |
using UIKit; | |
using Xamarin.Forms; | |
using Xamarin.Forms.Platform.iOS; | |
[assembly: ExportRenderer (typeof(CustomLabel), typeof(CustomLabelRenderer))] |
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
public static class ViewExtensions | |
{ | |
public static void Wobble (this View view, int wobbles = 4, Action completion = null) | |
{ | |
Task.Run (() => { | |
Device.BeginInvokeOnMainThread (async () => { | |
uint duration = 50; | |
var count = 4; | |
await view.RelRotateTo (5.0, duration, Easing.Linear); | |
for (var shake = 1; shake < count - 1; shake++) { |
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
public static void Shake (this View view, int shakes = 4, Action completion = null) | |
{ | |
Task.Run (() => { | |
Device.BeginInvokeOnMainThread (async () => { | |
uint duration = 50; | |
await view.TranslateTo (5.0, 0, duration, Easing.Linear); | |
for (var shake = 1; shake < shakes - 1; shake++) { | |
await view.TranslateTo (-10.0, 0, duration, Easing.Linear); | |
await view.TranslateTo (10.0, 0, duration, Easing.Linear); | |
} |
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
// from https://forums.xamarin.com/discussion/comment/154636/#Comment_154636 | |
public static Task<T> BeginInvokeOnMainThreadAsync<T>(Func<T> a) | |
{ | |
var tcs = new TaskCompletionSource<T>(); | |
Device.BeginInvokeOnMainThread(() => | |
{ | |
try | |
{ | |
var result = a(); | |
tcs.SetResult(result); |
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; | |
using System.Threading.Tasks; | |
namespace MyApp | |
{ | |
// Borrowed from @rid00z (http://www.michaelridland.com) | |
public static class AsyncMixin | |
{ | |
public static void RunForget(this Task t) | |
{ |
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
// https://forums.xamarin.com/discussion/comment/180081/#Comment_180081 | |
// Platform project | |
{ | |
var type = item.GetType(); | |
var prop = type.GetProperty(picker.DisplayMember); | |
picker.Items.Add(prop.GetValue(item).ToString()); | |
} | |
// PCL | |
{ |
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
<key>ITSAppUsesNonExemptEncryption</key><false/> |
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
private int GetNavBarHeight() | |
{ | |
int resourceId = Resources.GetIdentifier("navigation_bar_height", "dimen", "android"); | |
if (resourceId > 0) | |
{ | |
return Resources.GetDimensionPixelSize(resourceId); | |
} | |
return 0; | |
} |