Search code examples
silverlightfocusstackpanel

Silverlight StackPanel (or UserControl) focus issue


I am deriving a custom control from StackPanel (or just using the usual UserControl class). This control should be focusable within the application by either tabbing or clicking the control. When focus occurs, based on other criterion the control will expand and show certain elements. The control will also choose a default child control to focus on.

The issue I have is that I can find no way to focus on a UserControl. The Got/LostFocus events don't fire when I click on the control.

I am aware of the Focusable property, but it doesn't seem to be available on any of the client dlls for Silverlight (using v4 of SDK)

What I would really like is some advice on how best achieve the functionality of a panel I can tab to, as the UI design I have in mind hangs on this.


Solution

  • I guess the control you are looking for, is an Accordion or Expander control. Here, you will find steps to use the Accordion control. Hope that helps.