1
App.xaml中包含以下內容:樣式和觸發器在WPF
<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" />
一個StackPanel
內Grid
內。但是,當我將鼠標放在控件上時,它不會改變風格。我錯過了什麼?
@Dave Clemmer:請遠離wpf-prefixed標籤,同樣如果您要修改編輯,您可以多做一些工作,比如修正代碼的縮進距離太遠以至於... –
@HB會做,並將使用樣式而不是wpf-styles。試圖糾正濫用編碼風格標籤。 –