簡體   English   中英

樣式中的懸停效果不起作用(ToolBarPanel) - WPF c#

[英]Hover effect in style doesn't work (ToolBarPanel) - WPF c#

我有一個工具欄面板,我已經制作了自定義樣式。

<Window.Resources>
    <Style x:Key="toolbar_opciones" TargetType="{x:Type ToolBarPanel}">
        <Setter Property="Background" Value="DeepSkyBlue"/> <!-- does not work -->
        <Setter Property="Cursor" Value="Hand"/>
        <Style.Triggers>
            <Trigger Property="IsMouseOver"  Value="True">
                <Setter Property="Background" Value="CadetBlue"/>
            </Trigger> <!-- does not work -->
        </Style.Triggers>
    </Style>
</Window.Resources>
<ToolBarPanel Style="{StaticResource toolbar_opciones}"/>

光標工作,但背景屬性沒有,為什么?

我測試了你的代碼,這是修復

<ToolBarPanel Style="{StaticResource toolbar_opciones}"/>

仔細看看,你錯過了關閉Style屬性的雙引號。 當我將它添加到XAML ,已應用Background

干杯。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM