protected override void DoAttachBindings() { Bindings.Add(this.SetBinding(() => ViewModel.Target.Username, () => UsernameLabel.Text)); Bindings.Add(this.SetBinding(() => ViewModel.Target.PhotoUrl).WhenSourceChanges(() => { PhotoImageView.LoadImageWithTextPlaceholder( ViewModel.Target.PhotoUrl, ViewModel.Target.Username, StyleHelper.Style.AvatarStyles, x => x.Transform(new CircleTransformation())); })); Bindings.Add(this.SetBinding(() => ViewModel.Target.IsSelected, () => CheckBoxButton.Selected, BindingMode.TwoWay)); Bindings.Add(this.SetBinding(() => ViewModel.Target.IsActive).WhenSourceChanges(() => { var isActive = ViewModel.Target.IsActive; InactiveContactOverlay.Hidden = isActive; CheckBoxButton.Hidden = !isActive; UserInteractionEnabled = isActive; })); Bindings.Add(this.SetBinding(() => ViewModel.Target.IsOnline, () => OnlineIndicatorView.Hidden) .ConvertSourceToTarget(x => !x)); Bindings.Add(this.SetBinding(() => ViewModel.Target.IsSelectable, () => CheckBoxButton.Hidden) .ConvertSourceToTarget(x => !x)); }
protected override void DoAttachBindings() { Bindings.Add(this.SetBinding(() => ViewModel.Target.Username, () => UsernameLabel.Text)); Bindings.Add(this.SetBinding(() => ViewModel.Target.PhotoUrl).WhenSourceChanges(() => { PhotoImageView.LoadImageWithTextPlaceholder( ViewModel.Target.PhotoUrl, ViewModel.Target.Username, StyleHelper.Style.AvatarStyles, x => x.Transform(new CircleTransformation())); })); Bindings.Add(this.SetBinding(() => ViewModel.Target.IsSelected, () => CheckBoxButton.Selected, BindingMode.TwoWay)); Bindings.Add(this.SetBinding(() => ViewModel.Target.IsSelectable, () => CheckBoxButton.Hidden) .ConvertSourceToTarget(x => !x)); }