/// <summary>
        /// The constructor for an image button
        /// </summary>
        public ImageButton() : base()
        {
            var gestureRecognizer = new LongTapGestureRecognizer();

            //When tap event is invoked. add pressed color to image.
            gestureRecognizer.TapStarted += (s, e) =>
            {
                //change forground blend color of image
                ImageAttributes.SetBlendColor(this, Color.FromRgb(213, 228, 240));
            };

            //If tap is released. set default color to image.
            gestureRecognizer.TapCanceled += (s, e) =>
            {
                //revert forground blend color of image
                ImageAttributes.SetBlendColor(this, Color.Default);
                SendClicked();
            };

            //If tap is completed. set default color to image.
            gestureRecognizer.TapCompleted += (s, e) =>
            {
                //revert forground blend color of image
                ImageAttributes.SetBlendColor(this, Color.Default);
                SendClicked();
            };
            GestureRecognizers.Add(gestureRecognizer);
        }
예제 #2
0
        /// <summary>
        /// The constructor for an image button
        /// </summary>
        public ImageButton() : base()
        {
            var gestureRecognizer = new LongTapGestureRecognizer();

            gestureRecognizer.TapStarted += (s, e) =>
            {
                //change forground blend color of image
                ImageAttributes.SetBlendColor(this, Color.FromRgb(213, 228, 240));
            };

            gestureRecognizer.TapCanceled += (s, e) =>
            {
                //revert forground blend color of image
                ImageAttributes.SetBlendColor(this, Color.Default);
            };

            gestureRecognizer.TapCompleted += (s, e) =>
            {
                //revert forground blend color of image
                ImageAttributes.SetBlendColor(this, Color.Default);
            };
            GestureRecognizers.Add(gestureRecognizer);
            this.Effects.Add(Effect.Resolve("Tizen.ImageClickEffect"));
        }