有没有在WPF一些属性,我可以添加到元素,所以当我点击它的目标控制得到重点是什么?我已经发现的最接近的是“目标”,但它只能访问键的作用,并点击它没有任何效果。

有帮助吗?

解决方案

没有,而是一个可以由行为为这个工作。

其他提示

重写标签控制

public class LabelEx : Label
{
    public LabelEx() : base() {}

    protected override void OnMouseDown(System.Windows.Input.MouseButtonEventArgs e)
    {
        if (Target != null) Target.Focus();
        base.OnMouseDown(e);
    }
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top