I have an AutoCompleteBox in a C# WPF project. What I want is to have this box automatically focussed when the view is opened. I know there are some solutions out there in code, but I want to do this directly in the XAML (if possible).
So far I've tried the following, but it doesn't seem to do anything:
<controls:AutoCompleteBox x:Name="Items" ... Text="{Binding Search, Mode=TwoWay}">
<controls:AutoCompleteBox.TextBoxStyle>
<Style TargetType="TextBox">
<Setter Property="FocusManager.FocusedElement" Value="{Binding RelativeSource={RelativeSource Self}}" />
</Style>
</controls:AutoCompleteBox.TextBoxStyle>
</controls:AutoCompleteBox>
Something like this should do the trick