The Media Center Sandbox

Resources and discussion for developing experiences in the Windows Media Center platform.
Welcome to The Media Center Sandbox Sign in | Join | Help

Unexpected loss of focus

  •  03-05-2008, 10:17 AM

    Unexpected loss of focus

    <UI>
      <Content>
        <Panel Layout="Form">
          <Children>           
            <button:Button>
             <Model>
               <InvokeCommand Description="Button" Target="[any function]"/>
             </Model>               
           </button:Button>             
         </Children>           
        </Panel>
      </Content>
    </UI>

    Let's take the simplest example for our purpose, a panel containing a button (the button implementation is in the Z sample).
    The panel has a Form layout, so it fills all the screen.

    In theory, I would say there is only one object in this UI that can have the focus : the button. But if you click left with mouse wherever on the screen (except on the button ^ ^), the button loses the focus.

    In that case, the user can't know where the focus is, and you can try to use the keyboard arrows to give it back to the button, you won't succeed in it.
    The only solution I found to give back the focus to the button is to use the mouse.

    I presume that the focus has been given to the panel, but I don't understand why it works like this as far as I thought a panel couldn't get a direct focus (It can have a DeepFocus).

    Does anybody knows if this is really the desired behavior ? If it is, I would be curious to know the reason.
    I tried to solve that problem by adding the attribute 'MouseInteractive="false"' to the panel but it doesn't look to change anything.

View Complete Thread
Powered by Community Server, by Telligent Systems