none
c# 仿图片查看器 例如美图看看 QQ图片查看器那种 RRS feed

答案

  • 您好!

    根据我的经验,在WPF中,我们可以使用 Style技术达到这个效果。请参考下面的Style代码,

    <Style TargetType="ListBoxItem">
      <Setter Property="Opacity" Value="0.5" />
      <Setter Property="MaxHeight" Value="75" />
      <Style.Triggers>
    	<Trigger Property="IsSelected" Value="True">
    	  <Trigger.Setters>
    		<Setter Property="Opacity" Value="1.0" />
    	  </Trigger.Setters>
    	</Trigger>
    	<EventTrigger RoutedEvent="Mouse.MouseEnter">
    	  <EventTrigger.Actions>
    		<BeginStoryboard>
    		  <Storyboard>
    			<DoubleAnimation
    			  Duration="0:0:0.2"
    			  Storyboard.TargetProperty="MaxHeight"
    			  To="90"  />
    		  </Storyboard>
    		</BeginStoryboard>
    	  </EventTrigger.Actions>
    	</EventTrigger>
    	<EventTrigger RoutedEvent="Mouse.MouseLeave">
    	  <EventTrigger.Actions>
    		<BeginStoryboard>
    		  <Storyboard>
    			<DoubleAnimation
    			  Duration="0:0:1"
    			  Storyboard.TargetProperty="MaxHeight"  />
    		  </Storyboard>
    		</BeginStoryboard>
    	  </EventTrigger.Actions>
    	</EventTrigger>
      </Style.Triggers>
    </Style>

    运行效果截图:

    推荐您一些学习资料,

    #WPF Photo Viewer Demo

    http://code.msdn.microsoft.com/WPF-Photo-Viewer-Demo-be75662a

    #Styling and Templating

    http://msdn.microsoft.com/en-us/library/ms745683(v=vs.110).aspx

    如果您对我的回复有任何疑问,请随时联系我。

    祝您生活愉快!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2013年12月16日 2:39
    版主