How to set focus on NumericUpDown control?
I am trying to set focus on NumericUpDown element from WPFs extended toolkit.
I heve following XAML<Window ...
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
<Grid>
<StackPanel HorizontalAlignment="Center" VerticalAl开发者_StackOverflow中文版ignment="Center" Orientation="Horizontal" FocusManager.IsFocusScope="True">
<extToolkit:NumericUpDown HorizontalAlignment="Left" VerticalAlignment="Top" x:Name="ItemsCount" Value="1"/>
<TextBlock Text="XXX" Margin='10,0,0,0'/>
</StackPanel>
</Grid>
</Window>
I called Keyboard.Focus(ItemsCount)
and ItemsCount.Focus()
from constructor and from Loaded
event with no success.
P.S.
Calling Focus() works forTextBox
so it's must be control specific issue. Maybe it is not set to be focusable, have you checked the value of Focusable
?
Set the SelectAllOnGotFocus
property to True
NumericUpDown1.Select(0, 1)
'Set Tabstop to 1 'Initialize NumericUpDown1 with a single numeric value (i.e. "1").
精彩评论