Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Keyboard events question. RSS

3 replies

Last post Jun 09, 2007 02:21 PM by slyi

(0)
  • caseyr

    caseyr

    0 Points

    4 Posts

    Keyboard events question.

    May 11, 2007 06:23 PM | LINK

    For some reason I am not receiving KeyDown notifications for the arrow keys (left, right, up, down).  Has anyone else experienced this or found a work around for it?

     Thanks.
     

    Keys Keyboard Events

  • pbking

    pbking

    Member

    2 Points

    1 Post

    Re: Keyboard events question.

    May 11, 2007 10:40 PM | LINK

     Well, I've got the same problem.  I've got regular key notifications but I can't get the same treatment from the arrows.  They just don't respond.  Any help would be appreciated.

    event handler keyboard

  • Vivek Dalvi

    Vivek Dalvi

    Member

    468 Points

    123 Posts

    Microsoft

    Re: Keyboard events question.

    May 12, 2007 02:34 AM | LINK

    It works on Firefox but not on IE. This a known bug.

  • slyi

    slyi

    Participant

    1027 Points

    313 Posts

    Re: Keyboard events question.

    Jun 09, 2007 02:21 PM | LINK

    The method used in sample http://channel9.msdn.com/Showpost.aspx?postid=304500 worked for me in IE for the beta

     handleKeyUp : function ( sender, keyEventArgs )
        {
            var x =  this._lastSelected["Canvas.ZIndex"] ;
            if (keyEventArgs.key == 15)  // Up
            {           
                this._lastSelected["Canvas.ZIndex"] =  ++x;
            }
            else if (keyEventArgs.key == 17)  // Down
            {
                this._lastSelected["Canvas.ZIndex"] =  --x;
            } 
     else if ( keyEventArgs.key == 14 ) //Left
     {
         if ( this._lastSelected["Opacity"] > 0.1 )
       this._lastSelected["Opacity"] -= 0.1;
      
     }
     else if ( keyEventArgs.key == 16 )  // Right
     {
      if ( this._lastSelected["Opacity"] <= 0.9 )
       this._lastSelected["Opacity"] += 0.1;  
     }
     
           
           
        }