如何设置对NumericUpDown控件的关注? [英] How to set focus on NumericUpDown control?

查看:97
本文介绍了如何设置对NumericUpDown控件的关注?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将重点放在WPF扩展工具包中的NumericUpDown元素上。

我遵循XAML

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" VerticalAlignment="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>

我叫 Keyboard.Focus(ItemsCount) ItemsCount.Focus()分别来自构造函数和 Loaded 事件,均未成功。

控制当我按Tab时会得到焦点,但在我的情况下这是不可接受的。

我也没有在Google上找到问题。

有什么方法可以聚焦NumericUpDown吗?

I called Keyboard.Focus(ItemsCount) and ItemsCount.Focus() from constructor and from Loaded event with no success.
Control is getting focus when I press Tab, but in my case it is not acceptable.
I didn't found enything on google as well.
Is there any way to focus NumericUpDown?

PS

调用Focus()适用于 TextBox ,因此它必须是控件特定的问题。

P.S.
Calling Focus() works for TextBox so it's must be control specific issue.

推荐答案

也许未设置为可聚焦,是否检查了可聚焦

Maybe it is not set to be focusable, have you checked the value of Focusable?

这篇关于如何设置对NumericUpDown控件的关注?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆