0
Opacity屬性我有一個ListViewItem的控制樣式:錯誤,同時增加使用DoubleAnimation是
<EventTrigger RoutedEvent="ListViewItem.MouseEnter">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="BitmapEffect.Opacity"
From="0.0" To="1.0" Duration="0:0:0.5" AutoReverse="False" SpeedRatio="2" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="ListViewItem.MouseLeave">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="BitmapEffect.Opacity"
From="1.0" To="0.0" Duration="0:0:0.5" AutoReverse="False" SpeedRatio="2" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
我想,當鼠標在ListViewItem的,項目的邊界慢慢出現,當鼠標離開它,邊界效應消失, 但我得到這個錯誤,當鼠標都要離開項目:
Cannot resolve all property references in the property path 'BitmapEffect.Opacity'. Verify
that applicable objects support the properties.
注意的是,當我只用第一EventTrigger
其路由到ListViewItem.MouseEnter
,程序工作正確的!但它並不好看!
我在使用OuterGlowBitmapEffect!
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="BitmapEffect">
<Setter.Value>
<OuterGlowBitmapEffect GlowColor="SkyBlue" GlowSize="20" />
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="Black" />
</Trigger>
感謝您的答覆,但本作淡出整個的ListViewItem的。我想淡出並淡入ListViewItem的BitmapEffect的不透明屬性! 我之前嘗試過這種方式 Storyboard.TargetProperty =「BitmapEffect.Opacity」 但我再次得到相同的錯誤! – Jalal 2010-07-23 09:16:17
我編輯了我的XAML,請檢查。我不知道你使用的是什麼位圖效果。 – Ragunathan 2010-07-23 09:50:39
謝謝,但是這個也出現錯誤!我正在使用OuterGlowBitmapEffect。 – Jalal 2010-07-23 10:03:57