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 创建图片库的更多相关文章

  1. SharePoint Online 创建图片库

    前言 本文介绍如何在Office 365中创建图片库,以及图片库的一些基本设置. 正文 通过登录地址登录到Office 365的SharePoint Online站点中,我们可以在右上角的设置菜单中, ...

  2. WPF 中动态创建和删除控件

    原文:WPF 中动态创建和删除控件 动态创建控件 1.容器控件.RegisterName("Name",要注册的控件)   //注册控件 2.容器控件.FindName(" ...

  3. WPF简介:VS创建桌面应用程序

    1.简介 1/ 什么是WPF WPF,Windows Presentation Foundation也,译过来就是"Windows呈现基础",你看它的目的非常明确,就是用来把数据& ...

  4. 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 ...

  5. Visual Studio 2012中的为创建类时的添加注释模板

    我们往往需要给类添加注释,我们可以把注释块复制出来,放到文件中,然后在需要的时候,复制.粘贴.这样的重复劳动增加了程序员的体力劳动,而VS中给我们提供了项模版,我们只需要在其中修改一点点模版就能达到这 ...

  6. [Visual Studio] 开启Visual Studio 2012通过右键菜单创建单元测试(Unit Test)

    Visual Studio 2012可以说是迄今为止微软VS开发工具中用户体验最好的产品,无论是速度还是体验以及功能,都非常出色,但是,使用了一段时间后发现有一个之前版本VS都有的功能却在Visual ...

  7. SQL Server R2 2008中的SQL Server Management Studio 阻止保存要求重新创建表的更改问题的设置方法

    在2008中会加入阻止保存要求重新创建表的更改这个选项.症状表现为修改表结构的时候会"阻止"你. SQL Server 2008“阻止保存要求重新创建表的更改”的错误的解决方案是本 ...

  8. (转)Android Studio系列教程一下载与安装 背景Android Studio VS Eclipse准备下载创建HelloWorld项目

    背景 相信大家对Android Studio已经不陌生了,Android Studio是Google于2013 I/O大会针对Android开发推出的新的开发工具,目前很多开源项目都已经在采用,Goo ...

  9. android studio: 一个Android studio 3.3.2 无法创建新项目的问题

    记录一个AS无法创建新项目的问题. 今天想写一个测试Demo,点击上面的“Start a new Android Studio Project” ,填写完包名和项目路径后,点“Finish”, AS无 ...

随机推荐

  1. iOS杂谈-图片拉伸的实现

    如上图是一个按钮的背景图,在Android上,很多图片资源都是类似这样子的,但是由于按钮的高度及宽度与图片的世纪尺寸不同,所以需要采用9patch来实现拉伸处理, 可参考:http://www.cnb ...

  2. Unity 由Verlet数值积分产生的头发运动

    先发下效果图. 参考项目unitychan-crs-master与miloyip大神的博客 爱丽丝的发丝,使用Verlet数值积分,根据旧的现在位置与上一桢位置来计算现在的位置,得到新的方向,上面的运 ...

  3. Haproxy配置支持https获取用户IP地址

    global log 127.0.0.1 local0 chroot /var/lib/haproxy #chroot运行路径 pidfile /var/run/haproxy.pid #haprox ...

  4. [AX2012]发送广播邮件

    AX 2012可以使用MAPI或者SMTP发送邮件,MAPI是客户端方法,需要outlook的协作,而SMTP则是服务器端方法,要求SMTP允许AOS服务器通过它中继.这里要讲的就是如何通过SMTP发 ...

  5. Windows下Git安装指南

    参考<Git权威指南>安装整理,图书配套网址参见[1] 1. Cygwin下安装配置Git 1. 在Windows下安装配置Git有2种不同的方案 (1)msysGit, (2)Cygwi ...

  6. offsetof的使用

    #include <stddef.h> #define offsetof ( TYPE, m)   (size_t )&reinterpret_cast< const vol ...

  7. IOS内存管理学习笔记

    内存管理作为iOS中非常重要的部分,每一个iOS开发者都应该深入了解iOS内存管理,最近在学习iOS中整理出了一些知识点,先从MRC开始说起. 1.当一个对象在创建之后它的引用计数器为1,当调用这个对 ...

  8. POJ 1308 Is It A Tree?

    Is It A Tree? Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 18778   Accepted: 6395 De ...

  9. 【转载】[JS]让表单提交返回后保持在原来提交的位置上

    有时候,在网页中点击了页面中的按钮或是刷新了页面后,页面滚动条又 会回到顶部,想看后面的记录就又要拖动滚动条,或者要按翻页键,非常不方便,想在提交页面或者在页面刷新的时候仍然保持滚动条的位置不变,最好 ...

  10. 在server 2008/2003中 取消对网站的安全检查/去除添加信任网站

    新安装好Windows   Server   2003操作系统后,打开浏览器来查询网上信息时,发现IE总是“不厌其烦”地提示我们,是否需要将当前访问的网站添加到自己信任的站点中去:要是不信任的话,就无 ...