WPF加载和分页显示的图片列表,可多选,带水纹特效
源码下载地址:https://download.csdn.net/download/xing861000/10454542
<UserControl x:Class="WpfApplication5.FileListControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
xmlns:local="clr-namespace:WpfApplication5"
xmlns:trans="clr-namespace:Transitionals;assembly=Transitionals"
xmlns:transc="clr-namespace:Transitionals.Controls;assembly=Transitionals"
xmlns:transt="clr-namespace:Transitionals.Transitions;assembly=Transitionals"
xmlns:refl="clr-namespace:System.Reflection;assembly=mscorlib"
Loaded="UserControl_Loaded">
<UserControl.Resources>
<Style x:Key="PageButton" TargetType="Button">
<Style.Triggers>
<EventTrigger RoutedEvent="Button.MouseEnter">
<BeginStoryboard>
<Storyboard >
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:00.5000000" BeginTime="0"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:00.5000000" BeginTime="0" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="Button.MouseLeave">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:00.5000000" BeginTime="0"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:00.5000000" BeginTime="0"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="0.8" Duration="00:00:00.2000000" BeginTime="0" AutoReverse="True"/>
<DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="0.8" Duration="00:00:00.2000000" BeginTime="0" AutoReverse="True"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<transc:TransitionElement x:Name="TransitionBox">
<transc:TransitionElement.Transition>
<transt:FadeAndGrowTransition/>
</transc:TransitionElement.Transition>
<ListBox x:Name="PageFirst" SelectionChanged="PageFirst_SelectionChanged" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" BorderThickness="0">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="{Binding Columns}" Rows="{Binding Rows}">
</UniformGrid>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Style.Resources>
<!--SelectedItem with focus-->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
<!--SelectedItem without focus-->
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/>
</Style.Resources>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<local:UserControl1 x:Name="Item" Height="{Binding RowHeight}" Width="{Binding ColumnWidth}" Margin="2">
<local:UserControl1.Effect>
<BlurEffect Radius="0"/>
</local:UserControl1.Effect>
</local:UserControl1>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}},Path=IsSelected}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation To="1" BeginTime="0:0:0" Duration="0:0:0.1" Storyboard.TargetName="Item" Storyboard.TargetProperty="Effect.Radius" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation To="0" BeginTime="0:0:0" Duration="0:0:0.1" Storyboard.TargetName="Item" Storyboard.TargetProperty="Effect.Radius" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
<Setter TargetName="Item" Property="Background" Value="Transparent"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</transc:TransitionElement>
<Grid Grid.Row="1" Background="WhiteSmoke" Width="600" HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.Column="0">
<Label FontSize="14" Margin="0 7 0 0" Foreground="#FF3575A0" Content="共"/>
<Label FontSize="14" Margin="0 7 0 0" Foreground="#FF3575A0" Content="{Binding PageCount}"/>
<Label FontSize="14" Margin="0 7 0 0" Foreground="#FF3575A0" Content="页"/>
<Label FontSize="14" Margin="0 7 0 0" Foreground="#FF3575A0" Content="{Binding CurrentCount}"/>
<Label FontSize="14" Margin="0 7 0 0" Foreground="#FF3575A0" Content="/"/>
<Label FontSize="14" Margin="0 7 0 0" Foreground="#FF3575A0" Content="{Binding FileCount}"/>
</StackPanel>
<Button Width="48" Height="48" Grid.Column="1" Style="{StaticResource PageButton}" Click="BFirstPage_Click">
<Button.RenderTransform>
<ScaleTransform CenterX="24" CenterY="24" ScaleX="1" ScaleY="1"/>
</Button.RenderTransform>
<Button.Template>
<ControlTemplate>
<Image Source="Img/Button/button_begin.png"/>
</ControlTemplate>
</Button.Template>
</Button>
<Button Width="48" Height="48" Grid.Column="2" Style="{StaticResource PageButton}" Click="BPreviousPage_Click">
<Button.RenderTransform>
<ScaleTransform CenterX="24" CenterY="24" ScaleX="1" ScaleY="1"/>
</Button.RenderTransform>
<Button.Template>
<ControlTemplate>
<Image Source="Img/Button/button_rew.png"/>
</ControlTemplate>
</Button.Template>
</Button>
<StackPanel Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock FontSize="14" Margin="10 11 5 0" Foreground="#FF3575A0" Text="第" />
<TextBlock FontSize="14" Margin="0 11" Foreground="#FF3575A0" Text="{Binding CurrentPage}" />
<TextBlock FontSize="14" Margin="5 11 10 0" Foreground="#FF3575A0" Text="页" />
</StackPanel>
<Button Width="48" Height="48" Grid.Column="4" Style="{StaticResource PageButton}" Click="BNextPage_Click">
<Button.RenderTransform>
<ScaleTransform CenterX="24" CenterY="24" ScaleX="1" ScaleY="1"/>
</Button.RenderTransform>
<Button.Template>
<ControlTemplate>
<Image Source="Img/Button/button_ff.png"/>
</ControlTemplate>
</Button.Template>
</Button>
<Button Width="48" Height="48" Grid.Column="5" Style="{StaticResource PageButton}" Click="BLastPage_Click">
<Button.RenderTransform>
<ScaleTransform CenterX="24" CenterY="24" ScaleX="1" ScaleY="1"/>
</Button.RenderTransform>
<Button.Template>
<ControlTemplate>
<Image Source="Img/Button/button_end.png"/>
</ControlTemplate>
</Button.Template>
</Button>
<StackPanel Orientation="Horizontal" Grid.Column="6" HorizontalAlignment="Right">
<TextBox Height="30" Width="50" Margin="0 -8 0 0" VerticalContentAlignment="Center" TextAlignment="Right" Text="1" x:Name="PageIndex" KeyDown="PageIndex_KeyDown" TextChanged="PageIndex_TextChanged"/>
<Button Width="48" Height="48" Style="{StaticResource PageButton}" Click="BJump_Click" IsDefault="True" Focusable="True">
<Button.RenderTransform>
<ScaleTransform CenterX="24" CenterY="24" ScaleX="1" ScaleY="1"/>
</Button.RenderTransform>
<Button.Template>
<ControlTemplate>
<Image Source="Img/Button/button_rotate_cw.png"/>
</ControlTemplate>
</Button.Template>
</Button>
</StackPanel>
</Grid>
</Grid>
</UserControl>
WPF加载和分页显示的图片列表,可多选,带水纹特效相关推荐
- js中图片加载失败,显示默认图片
js处理img标签加载图片失败,显示默认图片 1.第一种方法: 如果已经引入了jquery插件,就很好办.没有的话,如果实在需要,可以附上代码: $('img').error(function(){$ ...
- 图片加载失败时,显示默认图片
当我们页面中需要加载一些图片时,可能由于网络问题,或者图片文件缺失等问题,导致图片不能正常展示 我们希望有一种降级处理的方式,可以在图片加载失败后显示一张我们预先设定好的默认图片 1.监听图片的 er ...
- 图片加载失败后显示默认图片
加载失败后显示默认图: <img :src="`${img}.png`" onerror="javascript:this.src='logo.png'" ...
- img 图片加载错误时显示默认图片
有时我们项目里的图片加载错误时(比如 404),为了友好体验,我们可以用一张默认图片来替代. 方法一:用 background 遮住原图片 <img src="no-such-pic. ...
- img图片加载错误时显示默认图片
JavaScript用的onerror事件,vue用的@error JavaScript写法 <img src="xxx" onerror="this.src='d ...
- Glide4 加载失败时显示默认图片
// 根据URL的首字母创建一个DRAWABLE TextDrawable drawable = TextDrawable.builder().buildRoundRect(getUrlFirstLe ...
- ionic 图片加载失败,显示默认图片代替
1.首先编写自定义指令 angular.module('starter.directives', []) //当图片找不到事显示替代图片.directive("errSrc", f ...
- Github无法加载或不显示图片问题
好久以前就发现Github无法加载或不显示图片,最近又严重影响日常使用.查找资料并总结解决步骤如下: 1.Mac终端输入 sudo vi /etc/hosts windows 修改文件WIN(C:\W ...
- Github无法加载或不显示图片解决办法
最近发现Github无法加载或不显示图片,严重影响日常使用.查找资料并总结解决步骤如下: 1.Mac终端输入 sudo vi /etc/hosts 2.输入密码后,点击 i键,进入Insert模式,将 ...
最新文章
- grub2 命令行进入系统
- QIIME 2用户文档. 6沙漠土壤分析Atacama soil(2018.11)
- 【重磅】Python版《统计学习导论》来啦!附代码链接!
- 物联网面临的7大网络安全威胁
- 一场实验室意外爆炸事故,解决了58年量子难题,让科学家意外发现“核电共振”...
- (二)linux内核准备及编译
- matlab 两幅图不同,如何把两个不同M文件的图放在一起
- Flask框架后端开发常见错误处理(2018/11/14)
- IntelliJ IDEA 项目结构旁边出现 0%methods,0% lines covered 解决
- 计算机中丢失setupxml.dll,Win7电脑安装VideoStudio Pro X6显示丢失SetupXML.dll文件怎么解决...
- Spring的beans标签下可以有其他标签
- c需要实现安装卸载Linux模块,Linux内核模块编译与加载
- bower使用中遇到的问题
- pgm图像修改java_PGM图片格式与代码
- spring boot整合SpringSecurity-04 使用jwt的方式认证
- 公历与儒略日的相互转化
- Redis持久化中的AOF(Append Only File)持久化
- 电脑软件兼容性测试,兼容性测试:安全软件_软件资讯软件评测-中关村在线
- python的符号怎么打_python plt可视化――打印特殊符号和制作图例代码
- 最新UI仿水滴筹系统源码+全开源Uniapp开发的
热门文章
- 使用Origin计算数据的上升\下降时间
- 华为WATCH Buds耳机为什么不充电?充不进电的原因和解决办法。
- 计算机高级语言c高起专阶段性作业2,高起专 网络教育计算机基础1考试试题及答案...
- LearnOpenGL 光照—光照贴图—练习(放射光贴图)
- touch命令-创建空文件
- twemproxy源码解析-前言:特性简介
- Nginx限制指定设备访问目录
- php代码怎么注释符号,Php入门教程之PHP注释符号和格式
- 华科计算机考研难度大吗,华中科技大学考研难吗?一般要什么水平才可以进入?...
- Python 二维数组操作