简体   繁体   English

如何更改 TabItem 的光标

[英]How to change cursor for TabItem

I'm trying to change TabItem cursor but it changes only when mouse is over a button.我正在尝试更改 TabItem 光标,但仅当鼠标悬停在按钮上时它才会更改。 The rest of control area still displays 'Arrow' cursor.控制区域的其余部分仍然显示“箭头”光标。 How to fix that?如何解决?

<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>

You can put your Button in something that will stretch to fill whole available space您可以将Button放在可以拉伸以填充整个可用空间的地方

<TabControl>
    <TabItem Header="Tab" Cursor="Wait">
        <Grid Background="Transparent">
            <Button Content="qwe" Height="25" />
        </Grid>
    </TabItem>
</TabControl>

like Grid in this example but note that you'll need to assign Background to something like Transparent otherwise it won't be hit test visible像这个例子中的Grid但请注意,您需要将Background分配给Transparent东西,否则它不会在命中测试中可见

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM