Skip to content

Instantly share code, notes, and snippets.

@fdundjer
Created June 26, 2018 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fdundjer/a4dc4c48e72a8af25997aeea1f2d8dde to your computer and use it in GitHub Desktop.
Save fdundjer/a4dc4c48e72a8af25997aeea1f2d8dde to your computer and use it in GitHub Desktop.
using System;
using Execom.TargetBinding.Core.ViewModels;
using Execom.TargetBinding.iOS.Converters;
using MvvmCross.Binding.BindingContext;
using MvvmCross.Platforms.Ios.Presenters.Attributes;
using MvvmCross.Platforms.Ios.Views;
using UIKit;
namespace Execom.TargetBinding.iOS.Views
{
[MvxRootPresentation]
public partial class MainView : MvxViewController<MainViewModel>
{
public MainView()
: base(nameof(MainView), null)
{
}
public override void ViewDidLoad()
{
LogoImageView.Image = LogoImageView.Image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
base.ViewDidLoad();
var set = this.CreateBindingSet<MainView, MainViewModel>();
set.Bind(ChangeTintColorButton).To(vm => vm.ChangeTintColorCommand);
set.Bind(LogoImageView).For(v => v.TintColor).To(vm => vm.ImageTintColor).TwoWay()
.WithConversion(new TwoWayNativeColorValueConverter());
set.Apply();
ResetColorToDefaultButton.TouchUpInside += (sender, args) =>
{
LogoImageView.TintColor = new UIColor((nfloat) (234 / 255.0), (nfloat) (78 / 255.0),
(nfloat) (81 / 255.0), (nfloat) (255 / 255.0));
};
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment