【问题标题】:Styles and triggers in wpfwpf 中的样式和触发器
【发布时间】:2011-09-20 15:06:24
【问题描述】:

App.xaml 包含以下内容:

<Application x:Class="KiramUI.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         StartupUri="Member.xaml">
<Application.Resources>
    <Style TargetType="{x:Type TextBox}">
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BitmapEffect">
                    <Setter.Value>
                        <OuterGlowBitmapEffect GlowColor="Gold" GlowSize="10"></OuterGlowBitmapEffect>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
</Application.Resources>

Member.xaml 具有以下内容:

<TextBox  Height="23" Name="textBox1" Width="188" Padding="0" Margin="2" />
<TextBox Height="23" Name="textBox2" Width="183" Margin="2" HorizontalAlignment="Left" />

StackPanelGrid 内。但是当我将鼠标放在控件上时它不会改变样式。我错过了什么吗?

【问题讨论】:

  • @Dave Clemmer:请远离以 wpf 为前缀的标签,如果要建议您可以做更多的编辑,比如修复代码的缩进向右移动太远.. .
  • @HB 可以,并且会使用样式而不是 wpf 样式。试图纠正滥用编码样式标签。

标签: wpf triggers styles


【解决方案1】:

我假设您的目标是 .NET 4,如果是这样,此功能是 removed

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-10-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-22
    • 2010-10-31
    相关资源
    最近更新 更多