alansiqueira27
alansiqueira27

Reputation: 8506

How to focus an image in Silverlight?

How to focus an image in Silverlight?

For example: imagine that when my page loads, It will focus on a texbox, so I don't have to click in there to control. I want the same with image control.

Upvotes: 1

Views: 587

Answers (2)

Jace Rhea
Jace Rhea

Reputation: 5018

It sounds like you want to make a button of the image and than set the button with the default focus.

Make a button with an image

Set button with focus

Upvotes: 1

Stefan Dragnev
Stefan Dragnev

Reputation: 14473

There is no way for an Image to acquire input focus directly.

Input focus is supported only on Controls and its descendants which have the properties IsEnabled and IsTabStop set to true. Image is derived from FrameworkElement, not from Control, so it's not technically a control.

You could create a UserControl that contains the image and then call .Focus() on the container control.

Upvotes: 3

Related Questions