Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6936679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:15:55+00:00 2026-05-27T12:15:55+00:00

I’m currently porting an application from iPhone to Windows Phone. The behaviour of buttons

  • 0

I’m currently porting an application from iPhone to Windows Phone.

The behaviour of buttons is quite different between the two platforms.

In particular, on an iPhone one can press a button and release the button outside of the button area.
iOS has two events for handling this: Touch Up Inside and Touch Up Outside

On Windows Phone and Silverlight however, the behaviour is different, and unfortunately not the one I want.

You have the Click method that is called when the button is clicked , either when it’s actually clicked or when it’s released ; one way or the other (behaviour controlled via ClickMode value)

If you press the button and release it while your finger isn’t on the button precisely, no event will occur (though the state of the button will change as proven by its change of appearance)

Ultimately, what I would like to achieve is being able to trigger an event when the button is released, and that event should occur when the finger is released in either case just like it does on iPhone.
For example:
Press the button, move the finger outside the button, release the finger -> event triggered
The problem is detecting when the finger leaves the screen and not when it just leaves the button (which can easily be detected through the OsIsPressedChangeed)

Any ideas whoulc be greatly appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:15:55+00:00Added an answer on May 27, 2026 at 12:15 pm

    Here is how I best managed to simulate a similar behaviour (key release event being generated even when the finger stop being on top of the button)

    public class CalcButton : Button
    {
        public delegate void CalcButtonHandler(object sender);
    
        public event CalcButtonHandler Pressed;
        public event CalcButtonHandler Released;
    
    
        private bool hasFocus = false;
        private bool _isPressed = false;
        private bool isPressed
        {
            set
            {
                if (value != _isPressed)
                {
                    _isPressed = value;
                    Debug.WriteLine(Name + (_isPressed ? " Button Is Pressed" : " Button Is Released"));
                    if (_isPressed)
                    {
                        // custom default press action
                        // here
                        if (Pressed != null)
                        {
                            Pressed(this);
                        }
                    }
                    else
                    {
                        if (Released != null)
                        {
                            Released(this);
                        }
                    }
                }
            }
    
            get
            {
                return _isPressed;
            }
        }
    
        protected override void OnIsPressedChanged(DependencyPropertyChangedEventArgs e)
        {
            Debug.WriteLine(Name + " is pressed change");
            if (hasFocus && !base.IsPressed)
            {
                isPressed = false;
            }
            else if (base.IsPressed)
            {
                isPressed = true;
            }
            base.OnIsPressedChanged(e);
        }
    
        protected override void OnLostFocus(RoutedEventArgs e)
        {
            hasFocus = false;
            _isPressed = false; // do not trigger key release event
            Debug.WriteLine(Name + " lost focus");
            base.OnLostFocus(e);
        }
    
        protected override void OnGotFocus(RoutedEventArgs e)
        {
            hasFocus = true;
            Debug.WriteLine(Name + " got focus");
            base.OnGotFocus(e);
        }
    
        protected override void OnHold(GestureEventArgs e)
        {
            _isPressed = false; // do not trigger key release event
            Debug.WriteLine(Name + " on hold");
            base.OnHold(e);
        }
    }
    

    There is still a minor issue ; if you press a button, hold it, press another button, the Released event is generated for the first button, even though it is still pressed. Not sure how to get around this

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tracked down a weird MySQL problem to the two different ways I was
I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.