I have this ListBox:
<ListBox Name='lbColor'> <ListBoxItem Content='Blue'/> <ListBoxItem Content='Red'/> <ListBoxItem Content='Orange'/> </ListBox>
This code pre-selects the choice alright, but doesn’t set the focus, how can I do that?
public Window1() { InitializeComponent(); lbColor.SelectedIndex = 1; lbColor.Focus = 1; }
You can use the Focus method: