2012-01-30 120 views

回答

2

http://msmvps.com/blogs/theproblemsolver/archive/2009/02/17/changing-the-mouseover-effect-on-a-silverlight-listbox.aspx

这里是通过一个教程(使用混合)设置不同的视觉状态去的文章。在页面的3/4左右有一个示例xaml片段。看看本节:

<vsm:VisualState x:Name="MouseOver"> 
    <Storyboard> 
     <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> 
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.2"/>  
     </DoubleAnimationUsingKeyFrames> 
     <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> 
      <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.2"/> 
     </DoubleAnimationUsingKeyFrames> 
    </Storyboard> 
</vsm:VisualState> 

改变比例相反的,你可以改变透明度......没有理由我们不能在Visul Studio中写的,为混合挑战的(像我一样)。

同时,请参阅http://jesseliberty.com/2010/07/09/visual-state-manager-a-z/一组教程使用Visial状态管理的巨大能力。