Studio for WPF:使用 C1TileView 创建图片库
C1TileView 提供了数据交互浏览的功能。允许我们设置最大化和最小化浏览模板,我们可以通过最小化模板快速定位详细浏览选项。
下面我们分步分享实现方法:
1.添加 C1TileView 到窗体,并且添加 8 个 C1TileViewItem。
2.添加 Image 地址作为 C1TileViewItem 显示内容,并且设置 Header 属性为图片名。
<c1:C1TileViewItem Header="Jellyfish.jpg"Content="Images/Jellyfish.jpg" />
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
设置最小化位置:
<c1:C1TileView Name="c1TileView1"MinimizedItemsPosition="Bottom" UpdateSourceCollection="False">
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
3.添加资源模板,添加最大化和最小化模板:
<UserControl.Resources><DataTemplate x:Key="template"><Grid><Image Source="{Binding}" /></Grid></DataTemplate><DataTemplate x:Key="mintemplate"><Grid Width="100" Height="75"><Image Source="{Binding}" /></Grid></DataTemplate><Style TargetType="c1:C1TileViewItem"><Setter Property="Padding" Value="0" /><Setter Property="ContentTemplateMinimized" Value="{StaticResource mintemplate}" /><Setter Property="ContentTemplateMaximized" Value="{StaticResource template}" /><Setter Property="ContentTemplate" Value="{StaticResource template}" /></Style></UserControl.Resources>
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
使用以上模板既可以完成图片浏览库的功能:

详细代码:
<UserControl x:Class="TileViewPhotos.MainPage"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"mc:Ignorable="d"d:DesignHeight="300" d:DesignWidth="400" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml"><UserControl.Resources><DataTemplate x:Key="template"><Grid><Image Source="{Binding}" /></Grid></DataTemplate><DataTemplate x:Key="mintemplate"><Grid Width="100" Height="75"><Image Source="{Binding}" /></Grid></DataTemplate><Style TargetType="c1:C1TileViewItem"><Setter Property="Padding" Value="0" /><Setter Property="ContentTemplateMinimized" Value="{StaticResource mintemplate}" /><Setter Property="ContentTemplateMaximized" Value="{StaticResource template}" /><Setter Property="ContentTemplate" Value="{StaticResource template}" /></Style></UserControl.Resources><Grid x:Name="LayoutRoot" Background="White"><c1:C1TileView Name="c1TileView1" MinimizedItemsPosition="Bottom" UpdateSourceCollection="False"><c1:C1TileViewItem Header="Chrysanthemum.jpg" Content="Images/Chrysanthemum.jpg" /><c1:C1TileViewItem Header="Desert.jpg" Content="Images/Desert.jpg" /><c1:C1TileViewItem Header="Hydrangeas.jpg" Content="Images/Hydrangeas.jpg" /><c1:C1TileViewItem Header="Jellyfish.jpg" Content="Images/Jellyfish.jpg" /><c1:C1TileViewItem Header="Koala.jpg" Content="Images/Koala.jpg" /><c1:C1TileViewItem Header="Lighthouse.jpg" Content="Images/Lighthouse.jpg" /><c1:C1TileViewItem Header="Penguins.jpg" Content="Images/Penguins.jpg" /><c1:C1TileViewItem Header="Tulips.jpg" Content="Images/Tulips.jpg" /></c1:C1TileView></Grid></UserControl>
更多关于 Studio for WPF 控件及特性,请参考:
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
http://www.gcpowertools.com.cn/products/componentone_studio_wpf.htm
Studio for WPF:使用 C1TileView 创建图片库的更多相关文章
- SharePoint Online 创建图片库
前言 本文介绍如何在Office 365中创建图片库,以及图片库的一些基本设置. 正文 通过登录地址登录到Office 365的SharePoint Online站点中,我们可以在右上角的设置菜单中, ...
- WPF 中动态创建和删除控件
原文:WPF 中动态创建和删除控件 动态创建控件 1.容器控件.RegisterName("Name",要注册的控件) //注册控件 2.容器控件.FindName(" ...
- WPF简介:VS创建桌面应用程序
1.简介 1/ 什么是WPF WPF,Windows Presentation Foundation也,译过来就是"Windows呈现基础",你看它的目的非常明确,就是用来把数据& ...
- ASP.NET Core 中文文档 第二章 指南(1)用 Visual Studio Code 在 macOS 上创建首个 ASP.NET Core 应用程序
原文:Your First ASP.NET Core Application on a Mac Using Visual Studio Code 作者:Daniel Roth.Steve Smith ...
- Visual Studio 2012中的为创建类时的添加注释模板
我们往往需要给类添加注释,我们可以把注释块复制出来,放到文件中,然后在需要的时候,复制.粘贴.这样的重复劳动增加了程序员的体力劳动,而VS中给我们提供了项模版,我们只需要在其中修改一点点模版就能达到这 ...
- [Visual Studio] 开启Visual Studio 2012通过右键菜单创建单元测试(Unit Test)
Visual Studio 2012可以说是迄今为止微软VS开发工具中用户体验最好的产品,无论是速度还是体验以及功能,都非常出色,但是,使用了一段时间后发现有一个之前版本VS都有的功能却在Visual ...
- SQL Server R2 2008中的SQL Server Management Studio 阻止保存要求重新创建表的更改问题的设置方法
在2008中会加入阻止保存要求重新创建表的更改这个选项.症状表现为修改表结构的时候会"阻止"你. SQL Server 2008“阻止保存要求重新创建表的更改”的错误的解决方案是本 ...
- (转)Android Studio系列教程一下载与安装 背景Android Studio VS Eclipse准备下载创建HelloWorld项目
背景 相信大家对Android Studio已经不陌生了,Android Studio是Google于2013 I/O大会针对Android开发推出的新的开发工具,目前很多开源项目都已经在采用,Goo ...
- android studio: 一个Android studio 3.3.2 无法创建新项目的问题
记录一个AS无法创建新项目的问题. 今天想写一个测试Demo,点击上面的“Start a new Android Studio Project” ,填写完包名和项目路径后,点“Finish”, AS无 ...
随机推荐
- Mac eclipse找不到source的解决办法
因为要搞hadoop,最终还是逃不过写java的命运... eclipse里想查具体函数源代码时,如果报错说找不到源: 试试ls -l which java,在这个目录周围看看能不能找到src.zip ...
- wordpress使用技巧
1.iis6下wordpress去掉index.php 1)安装ISAPIRewritev3.1.0.73 http://bbs.z.admin5.com/forum.php?mod=viewthre ...
- Window中调试HBase问题小结
1.好久没用log4j了,转到logback好多年了,hbase程序运行时,报缺少log4j配置,那么,就转去logback吧(以下的XXX表示版本号). 原先lib包里面有log4j-XXX.jar ...
- Part 2: Oracle E-Business Suite on Cloud FAQ
Running Oracle E-Business Suite on Oracle Cloud is simple, but it doesn't take too much effort to co ...
- VMware的使用
1.问题的提出 现在所有的组装台式机,均以64位操作系统作为平台 而且USB接口均以USB3.0默认 windows7 64位和windows 10 64位是主流 那么建立在windo ...
- ext 3.x 让uploadPanel支持swfupload
经常做系统的时候会遇到上传组件,特别是大文件的时候总是很郁闷,长时间无响应导致糟糕的用户体验,所以决定采用swfupload来支持文件上传. 大体代码如下. var upload = {}; uplo ...
- 注意Activator.CreateInstance两个重载方法的性能
今天扩展一个Type的扩展方法New: public static object New(this Type type, params object[] args) { Guard.ArgumentN ...
- Popup 显示阴影
WPF Popup: How to put a border around the popup? 通过设置 Border 的 margin 来为阴影留出位置,并设置 Popup: AllowsTran ...
- Metatable和Metamethod
Metatable和Metamethod是用来干啥的?它们可以使得表a和b的表达式“a + b”变得有意义,其中metatable使两个不相关的表a和b之间可以进行操作,而操作的具体行为比如说&quo ...
- NPM使用详解(上)
1.NPM是什么? NPM是JavaScript的包管理工具,在安装NodeJS(什么?你不知道node?来,我们合计合计:https://nodejs.org/)的时候,会自动安装上npm. 要查看 ...