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 Xamarin.Forms; | |
namespace EffectsSample | |
{ | |
public class SwitchEffect : RoutingEffect | |
{ | |
public SwitchEffect () : base ("MyCompany.SwitchEffect") | |
{ | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:EffectsSample" x:Class="EffectsSample.EffectsSamplePage"> | |
<Switch VerticalOptions="Center" HorizontalOptions="Center"> | |
<Switch.Effects> | |
<local:SwitchEffect /> | |
</Switch.Effects> | |
</Switch> | |
</ContentPage> |
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 Android.Graphics; | |
using Android.Support.V7.Widget; | |
using EffectsSample.Droid; | |
using Xamarin.Forms; | |
using Xamarin.Forms.Platform.Android; | |
[assembly: ResolutionGroupName ("MyCompany")] | |
[assembly: ExportEffect (typeof (SwitchEffect), "SwitchEffect")] | |
namespace EffectsSample.Droid | |
{ |
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.Linq; | |
using Xamarin.Forms; | |
namespace EffectsSample | |
{ | |
public static class SwitchColorEffect | |
{ | |
public static readonly BindableProperty TrueColorProperty = BindableProperty.CreateAttached ("TrueColor", typeof (Color), typeof (SwitchColorEffect), Color.Transparent, propertyChanged: OnColorChanged); | |
private static void OnColorChanged (BindableObject bindable, object oldValue, object newValue) |
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
// Android SwitchEffect.cs | |
public class SwitchEffect : PlatformEffect | |
{ | |
Xamarin.Forms.Color _trueColor; | |
protected override void OnAttached () | |
{ | |
if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.JellyBean) { | |
_trueColor = (Xamarin.Forms.Color)Element.GetValue (SwitchColorEffect.TrueColorProperty); |
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
<?xml version="1.0" encoding="utf-8"?> | |
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:EffectsSample" x:Class="EffectsSample.EffectsSamplePage"> | |
<Switch VerticalOptions="Center" HorizontalOptions="Center" local:SwitchColorEffect.TrueColor="Yellow"> | |
<!--<Switch.Effects> | |
<local:SwitchEffect /> | |
</Switch.Effects>--> | |
</Switch> | |
</ContentPage> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<ContentPage Title="INotifyPropertyChanged" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:propertychangedfodysample" x:Class="propertychangedfodysample.propertychangedfodysamplePage"> | |
<StackLayout VerticalOptions="Center" HorizontalOptions="Center"> | |
<Label Text="{Binding SampleText}" /> | |
<Button Text="Change Text!" Clicked="Handle_Clicked" /> | |
<Button Text="Go to Fody >" Clicked="Handle_Clicked1" /> | |
</StackLayout> | |
</ContentPage> |
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.ComponentModel; | |
namespace propertychangedfodysample | |
{ | |
public class propertychangedfodysamplePageModel : INotifyPropertyChanged | |
{ | |
private string _sampleText; | |
public string SampleText { | |
get { return _sampleText; } |
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
<?xml version="1.0" encoding="utf-8"?> | |
<ContentPage Title="Fody" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:propertychangedfodysample" x:Class="propertychangedfodysample.propertychangedfodysampleWithFodyPage"> | |
<StackLayout VerticalOptions="Center" HorizontalOptions="Center"> | |
<Label Text="{Binding SampleText}" /> | |
<Button Text="Change Text!" Clicked="Handle_Clicked" /> | |
</StackLayout> | |
</ContentPage> |
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 PropertyChanged; | |
namespace propertychangedfodysample | |
{ | |
[ImplementPropertyChanged] | |
public class propertychangedfodysampleWithFodyPageModel | |
{ | |
public string SampleText { | |
get; | |
set; |