【发布时间】:2011-06-08 18:24:11
【问题描述】:
我的应用程序中有一些自定义光标。 我使用 informations found on the second answer here 来创建我的自定义光标。这很好用。 我的问题是,当我将鼠标移到弹出窗口上时,鼠标显示为默认光标。奇怪的是,当我将鼠标移出弹出窗口时,我的自定义光标又回来了。 好的,所以我像这样实例化我的光标:
UserControl.xaml:
<TextBlock
x:Name="SupprimerV"
x:Key="SupprimerV"
Cursor="../Utils/Supprimer.cur"/>
在 UserControl.xaml.cs 中:
this.Cursor = ((TextBlock)this.FindResource("SupprimerV")).Cursor;
然后我调用我自己的控件 SimplePopup,它是从 Popup 派生的,如下所示:
_pop = new SimplePopup(this); //Irrelevant information omitted
SimplePopup.cs:
public simplePopup(FrameworkElement relativeTo)
{
this._relativeTo = relativeTo;
this.Cursor = relativeTo.Cursor; //Trying to set the cursor of the popup but dosent work
...
}
我尝试设置弹出光标,但它似乎不起作用。 光标在我的 UserControl 上工作正常,但当鼠标悬停在 Popup 上时失败。
我错过了什么? 是否有什么东西阻止我的光标在弹出窗口上正常工作?
感谢您的帮助, 拼写错误见谅^^
【问题讨论】: