Kirk Broadhurst
Kirk Broadhurst

Reputation: 28728

"Ambiguous match found" when using FocusManager.FocusedElement

I don't think I've ever had a compile-time error of Ambiguous match found - I associate it with runtime exceptions.

When I add a FocusManager.FocusedElement setter in my XAML I get the build error, no further detail. I've tried adding this attribute in a number of places (control root, the parent element, the target element), and in a number of controls, and for a number of targets.

Any suggestions on what to do now? Completely lost.

I'm also unable to set the focus to the target control in the code behind. I don't know if this is related...

Upvotes: 1

Views: 1086

Answers (1)

LueTm
LueTm

Reputation: 2380

I found a solution!

<i:Interaction.Triggers>
    <i:EventTrigger EventName="Loaded">
        <util:SetFocusTrigger TargetName="SearchBox" />
    </i:EventTrigger>
</i:Interaction.Triggers>

More info here: http://www.codeproject.com/Articles/222613/Setting-focus-on-a-control-in-Silverlight-using-XA

Upvotes: 1

Related Questions