2012-01-30 147 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狀態管理的巨大能力。