Created
August 18, 2014 15:58
-
-
Save dmunch/3b66a9155de48a97e6f2 to your computer and use it in GitHub Desktop.
Gist for Xamarin.Forms blog series http://pause.coffee/blog/xamarin-forms-ii-custom-attached-properties-and-behaviors/
This file contains 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.Collections.Generic; | |
using System.Globalization; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Xamarin.Forms; | |
namespace Luax.Xaml.AttachedBehaviours.Blog | |
{ | |
class NegateConverter : IValueConverter | |
{ | |
public object Convert(object value, Type targetType, | |
object parameter, CultureInfo culture) | |
{ | |
return !((bool)value); | |
} | |
public object ConvertBack(object value, Type targetType, | |
object parameter, CultureInfo culture) | |
{ | |
return !((bool)value); | |
} | |
} | |
class ClickBehaviorTestViewModel : ViewModel | |
{ | |
public Command Clicked { get; set; } | |
protected bool isChecked = false; | |
public bool IsChecked | |
{ | |
get { return isChecked; } | |
set { this.ChangeAndNotify(ref isChecked, value); } | |
} | |
public ClickBehaviorTestViewModel() | |
{ | |
this.Clicked = new Command(p => OnClicked(p)); | |
} | |
public void OnClicked(object p) | |
{ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment