【问题标题】:How to change cursor for TabItem如何更改 TabItem 的光标
【发布时间】:2014-07-03 11:42:37
【问题描述】:

我正在尝试更改 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>

【问题讨论】:

    标签: c# .net wpf xaml


    【解决方案1】:

    您可以将Button 放在可以伸展以填满整个可用空间的地方

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

    在此示例中类似于 Grid,但请注意,您需要将 Background 分配给 Transparent 之类的东西,否则它不会被命中测试可见

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-16
      相关资源
      最近更新 更多