【问题标题】:How to write a style for HyperlinkButton Shadow effect in Silverlight如何在 Silverlight 中为 HyperlinkBut​​ton 阴影效果编写样式
【发布时间】:2014-05-29 22:17:44
【问题描述】:

根据自定义需求,我有一个样式化的 HyperlinkBut​​ton,如下所示:

<HyperlinkButton Tag="Transactions/HomeWorkPage"
                 Background="#E9E9EB" Foreground="Black">
       <HyperlinkButton.Effect>
           <DropShadowEffect Direction="270" Opacity="0.35" ShadowDepth="3"/>
       </HyperlinkButton.Effect>
       <StackPanel Orientation="Horizontal">
           <Image Source="/SchoolMgmt;component/Assets/Images/R_Homework.png"
               Margin="10,0,1,0"/>
           <telerik:Label Content="Home Work" CharacterSpacing="25"
               telerik:StyleManager.Theme="{Binding SelectedTheme,Mode=TwoWay}"
               FontSize="12" FontFamily="Arial Rounded MT" Margin="3"/>
        </StackPanel>                                            
 </HyperlinkButton>

现在对结果感到满意,我开始为此编写样式资源,以便我可以在任何我想要的地方使用。

这是我能写的:

<Style x:Name="QuickLinkStyle" TargetType="HyperlinkButton">
        <Setter Property="Background" Value="#E9E9EB"/>
        <Setter Property="Foreground" Value="Black"/>
</Style>

我无法将关注转换为样式

<HyperlinkButton.Effect>
    <DropShadowEffect Direction="270" Opacity="0.35" ShadowDepth="3"/>
</HyperlinkButton.Effect>

我不是设计师,也不使用表情混合来编写样式。我试着用谷歌搜索它。但我能找到的只是 DataTemplate 、 VisualStates 等。它非常令人困惑。

【问题讨论】:

    标签: silverlight xaml user-interface styles


    【解决方案1】:

    所以这不起作用?

    <Style x:Name="QuickLinkStyle" TargetType="HyperlinkButton">
        ...
        <Setter Property="Effect">
            <Setter.Value>
                <DropShadowEffect .../>
            </Setter.Value>
        </Setter>
    </Style>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-19
      • 1970-01-01
      • 1970-01-01
      • 2010-10-05
      • 1970-01-01
      相关资源
      最近更新 更多