none
How does the Password Reveal Button on win8 login interface show whenever it gets focus?

    Question

  • Hi all,

        In my metro app, the password reveal button will automatically hide after I hit other places outside the password box, and never show again unless I refresh the page or empty the password box. A blog gives some talks about this in the chapter "Is the Password Reveal Button always available ?":

        http://www.technospot.net/blogs/windows-8-how-to-remove-password-reveal-button/http://www.technospot.net/blogs/windows-8-how-to-remove-password-reveal-button/

        But I noticed that there is an exception case: the password box on win8 login interface! Whenever I leave the password box and come back, it will automatically show the password reveal button.

        I want to know:

        1) How to implement the behavior like the password box on win8 login interface in our metro app? That is, how to show password reveal button again after the password lose focus and then get focus again?

        2) Why does the password reveal button in password box in metro app will never show again after the password box lose focus? Is it based on safe consideration? If so, why is the win8 login interface an exception?

    Monday, October 29, 2012 2:46 AM

Answers

  • Seems the password box codes it, the reveal button visual state in the PasswordBox just set its Visible:

    <VisualStateGroup x:Name="ButtonStates">
        <VisualState x:Name="ButtonVisible">
            <Storyboard>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="RevealButton">
                    <DiscreteObjectKeyFrame KeyTime="0">
                        <DiscreteObjectKeyFrame.Value>
                            <Visibility>Visible</Visibility>
                        </DiscreteObjectKeyFrame.Value>
                    </DiscreteObjectKeyFrame>
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
        </VisualState>
        <VisualState x:Name="ButtonCollapsed"/>
    </VisualStateGroup>

    I tried to set the RevealButton visible in PointOver and Focused states, it can show the button but cannot handle the click event on the reveal button. So the behaviour is coded in the PasswordBox control, and cannot be changed.

    Left solution is to design one inherit class from TaxBox and generate the PasswordBox function yourself.


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by steve xue Monday, October 29, 2012 8:03 AM
    Monday, October 29, 2012 7:49 AM
    Moderator

All replies

  • Seems the password box codes it, the reveal button visual state in the PasswordBox just set its Visible:

    <VisualStateGroup x:Name="ButtonStates">
        <VisualState x:Name="ButtonVisible">
            <Storyboard>
                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="RevealButton">
                    <DiscreteObjectKeyFrame KeyTime="0">
                        <DiscreteObjectKeyFrame.Value>
                            <Visibility>Visible</Visibility>
                        </DiscreteObjectKeyFrame.Value>
                    </DiscreteObjectKeyFrame>
                </ObjectAnimationUsingKeyFrames>
            </Storyboard>
        </VisualState>
        <VisualState x:Name="ButtonCollapsed"/>
    </VisualStateGroup>

    I tried to set the RevealButton visible in PointOver and Focused states, it can show the button but cannot handle the click event on the reveal button. So the behaviour is coded in the PasswordBox control, and cannot be changed.

    Left solution is to design one inherit class from TaxBox and generate the PasswordBox function yourself.


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by steve xue Monday, October 29, 2012 8:03 AM
    Monday, October 29, 2012 7:49 AM
    Moderator
  • Thanks a lot.
    Monday, October 29, 2012 8:02 AM