private void ColorTapGestureRecognizer_Tapped(object sender, EventArgs e) { tappedAvatar = (sender as ColorBackgroundAvatar); if (tappedAvatar.ContentType == ContentType.AvatarCharacter) { SetDefaultAvatar(); } else { SetColorToAvatar(); } }
private ColorBackgroundAvatar GetColorPickerItem(Color backgroundColor, Color startcolor, Color stopcolor) { ColorBackgroundAvatar colorAvatar = new ColorBackgroundAvatar(); colorAvatar.BackgroundColor = backgroundColor; colorAvatar.BorderColor = Color.FromHex("#9E9E9E"); colorAvatar.InitialsColor = Color.Transparent; colorAvatar.AvatarShape = AvatarShape.Circle; colorAvatar.AvatarSize = AvatarSize.Medium; colorAvatar.VerticalOptions = LayoutOptions.Center; colorAvatar.HorizontalOptions = LayoutOptions.Center; TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += ColorTapGestureRecognizer_Tapped; colorAvatar.GestureRecognizers.Add(tapGestureRecognizer); colorAvatar.StartColor = startcolor; colorAvatar.StopColor = stopcolor; return(colorAvatar); }