我正在尝试更改 TabItem 光标,但仅当鼠标悬停在按钮上时它才会更改。控制区域的其余部分仍然显示“箭头”光标。如何解决这个问题?
<Window x:Class="WpfApplication4.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<TabControl>
<TabItem Header="Tab" Cursor="Wait">
<Button Content="qwe" Height="25" />
</TabItem>
</TabControl>
</Window>
最佳答案
您可以将按钮
放在可以拉伸(stretch)以填充整个可用空间的位置
<TabControl>
<TabItem Header="Tab" Cursor="Wait">
<Grid Background="Transparent">
<Button Content="qwe" Height="25" />
</Grid>
</TabItem>
</TabControl>
就像本例中的Grid
,但请注意,您需要将Background
分配给Transparent
之类的东西,否则它不会被 HitTest 可见
关于c# - 如何更改 TabItem 的光标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24552790/