模仿微软的例子,自己写了个,效果图如下: 未选中时,透明度为0.5,鼠标悬停时,图片动画效果增大30个像素。鼠标离开 变回原始大小 选中图片透明度为1.0。下面直接上代码: 后台: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace WPFPro { /// <summary> /// WPFDemo1.xaml 的交互逻辑 /// </summary> public partial class WPFDemo1 : Window { public WPFDemo1() { InitializeComponent(); } //定义全局变量 List<MPictures> list = null; private void Window_Loaded(object sender, RoutedEventArgs e) { InitInfo(); ToBindListBox(); } /// <summary> /// 初始化图片源 /// </summary> public void InitInfo() { list = new List<MPictures>(){ new MPictures{Id=1,ISource="Images/image1.gif"}, new MPictures{Id=2,ISource="Images/image2.gif"},