- 浏览: 1525344 次
- 性别:
- 来自: 杭州
文章分类
- 全部博客 (525)
- SEO (16)
- JAVA-EE-Hibernate (6)
- JAVA-EE-Struts (29)
- JAVA-EE-Spring (15)
- Linux (37)
- JAVA-SE (29)
- NetWork (1)
- CMS (14)
- Semantic Research (3)
- RIA-Flex (0)
- Ajax-Extjs (4)
- Ajax-Jquery (1)
- www.godaddy.com (0)
- SSH (34)
- JavaScript (6)
- SoftwareEngineer (9)
- CMMI (0)
- IDE-Myeclipse (3)
- PHP (1)
- Algorithm (3)
- C/C++ (18)
- Concept&Items (2)
- Useful WebSite (1)
- ApacheServer (2)
- CodeReading (1)
- Socket (2)
- UML (10)
- PowerDesigner (1)
- Repository (19)
- MySQL (3)
- SqlServer (0)
- Society (1)
- Tomcat (7)
- WebService (5)
- JBoss (1)
- FCKeditor (1)
- PS/DW/CD/FW (0)
- DesignPattern (11)
- WebSite_Security (1)
- WordPress (5)
- WebConstruction (3)
- XML|XSD (7)
- Android (0)
- Project-In-Action (9)
- DatabaseDesign (3)
- taglib (7)
- DIV+CSS (10)
- Silverlight (52)
- JSON (7)
- VC++ (8)
- C# (8)
- LINQ (1)
- WCF&SOA (5)
- .NET (20)
- SOA (1)
- Mashup (2)
- RegEx (6)
- Psychology (5)
- Stock (1)
- Google (2)
- Interview (4)
- HTML5 (1)
- Marketing (4)
- Vaadin (2)
- Agile (2)
- Apache-common (6)
- ANTLR (0)
- REST (1)
- HtmlAnalysis (18)
- csv-export (3)
- Nucth (3)
- Xpath (1)
- Velocity (6)
- ASP.NET (9)
- Product (2)
- CSS (1)
最新评论
-
lt26w:
理解成门面模式应该比较容易明白吧
FacadePattern-Java代码实例讲解 -
lt26w:
看下面的例子比较明白.
FacadePattern-Java代码实例讲解 -
javaloverkehui:
这也叫文档,别逗我行吗,也就自己看看。
HtmlCleaner API -
SE_XiaoFeng:
至少也应该写个注释吧。
HtmlCleaner API -
jfzshandong:
...
org.springframework.web.filter.CharacterEncodingFilter 配置
Silverlight Carousel: Creating a Silverlight Control Displays Picture in an Inte
- 博客分类:
- Silverlight
http://www.codeproject.com/KB/silverlight/carousel.aspx
- Click here view a running sample
- Download source - 47.32 KB
- Download Version of Silverlight 3 Source Carousel_src_v3.zip - 1.15 MB
Introduction and Background
What is Carousel? Carousel is just a Silverlight 2.0 (now it's has
been updated to Silverlight v3) control which can display collections
of pictures like a carousel (have you ever see a carousel?). When I
creating Mashup in Microsoft Popfly
I saw a display control named "Carousel." It was very attractive to me
so I wanted to find one like this to use it in my own application.
Using Google I found YetAnotherCarousel
, but it was too
coarse to use. And the other one I found was created in Silverlight V1
and was very hard to use. But the idea dogged me, attracted me day and
night. I Googled again and again but could not find a perfect one. So
one day, I asked myself, "Why not create one for myself?"
Key Features
- It's really a Silverlight V2 (v3 also) Control, all written in C#.
- Very simple to use.
- Has many useful properties to control it's behaviour.
- Can turning continuous or step by step.
Using the Control
Using the Carousel control is very simple just like any other control. First of all, you add the assembly (cokkiy.display.carousel
) and reference it to your Silverlight Project. Then look at the code:
- Add the XMLNS reference to your Page XAML file beginning.
Collapse
< UserControl x:Class =" ControlTest.Page" xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x =" http://schemas.microsoft.com/winfx/2006/xaml" xmlns:display =" clr-namespace:Cokkiy.Display;assembly=Cokkiy.Display.Carousel" Width =" 800" Height =" 600" >
- Place the Carousel in your layout control. I put it in a grid, and you can put it in any
UIElement
as a content or child item.Collapse< display:Carousel x:Name =" carousel" TurnDirection =" Counterclockwise" Padding =" 5,5,5,5" > < display:Carousel.Background > < LinearGradientBrush EndPoint =" 0.5,0" StartPoint =" 0.5,1" > < GradientStop Color =" #FF000000" / > < GradientStop Color =" #FFFFFFFF" Offset =" 1" / > < / LinearGradientBrush > < / display:Carousel.Background > < display:Carousel.ItemSources > < display:ItemSource Title =" 01" ImageSource =" Images/01.jpg" / > < display:ItemSource Title =" 02" ImageSource =" Images/02.jpg" / > < display:ItemSource Title =" 03" ImageSource =" Images/03.jpg" / > < display:ItemSource Title =" 04" ImageSource =" Images/04.jpg" / > < display:ItemSource Title =" 05" ImageSource =" Images/05.jpg" / > < display:ItemSource Title =" 06" ImageSource =" Images/06.jpg" / > < display:ItemSource Title =" 07" ImageSource =" Images/07.jpg" / > < display:ItemSource Title =" 08" ImageSource =" Images/08.jpg" / > < / display:Carousel.ItemSources > < / display:Carousel >
The ImageSource property just is the Silverlight Image's source, so you can set it any valid Url as Image's source do, more info about it you can refer MSDN's Image's source property.
Notice how I added a Carousel in my page. The Carousel has 8 images as its children. Let's look at the screen capture.
How It Works?
From the screen capture we can know the Carousel is composed of three main parts. The Canvas
where the image placed, the small item (the carousel leaf) contains an
image which can turn around with the ellipse (it is a virtual image
ellipse does not exist) and the panel displays the selected image (the
large image in the picture). All three parts are also Silverlight
controls which have their own properties. The carousel leaf control I
called is CarouselItem
which calculates the position of where to place the Canvas
,
and the scale range by itself. The key point is in placing each item in
a proper point and making its size fit any position, and making it turn
along with the ellipse.
To make the Carousel control like a real carousel, we must ensure:
- The farther item is smaller than the nearer item, and the nearest item is the biggest item.
- The item in the back (father) is under the item in the front (near).
- The item in the foreground is blurred.
Let's see the following figure demo the concept.
When the center point, O
, is constant, the positon and size of CarouselItem
at point P
only depends to the angle of A
. We can calc the positon and size like following code.
// Position double dx = Axis.Width * Math.Cos(newAngle) + Center.X; double dy = Axis.Height * Math.Sin(newAngle) + Center.Y; Canvas.SetLeft(this , dx); Canvas.SetTop(this , dy); // Scale double sc = 2 + Math.Cos(newAngle - Math.PI / 2 ); ScaleTransform st = ( this .RenderTransform as TransformGroup).Children[0 ] as ScaleTransform; st.ScaleX = sc; st.ScaleY = sc; // Set the ZIndex based the distance from us, the far item // is under the near item Canvas.SetZIndex(this , (int )dy);
The position and size all only depends on the angle, so it's very
easy to make it turn around the ellipse. Silverlight support the DependencyProperty
animation, so we make the angle as a DependencyProperty
. And make a DoubleAnimation
on each item's angle property. The DoubleAnimation
has a property named By
which means the total amount by which the animation changes its
starting value. When we set it to 2*PI, it starts turning a lap.
Storyboard storyboard = new Storyboard(); // this.Resources.Add(name, storyboard); // Angle animation DoubleAnimation doubleAnimation = new DoubleAnimation(); doubleAnimation.By = 2*Math.PI; doubleAnimation.Duration = duration; doubleAnimation.RepeatBehavior = RepeatBehavior.Forever; // Set storyboard target property storyboard.Children.Add(doubleAnimation); Storyboard.SetTarget(doubleAnimation, item); Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath(" Angle" ));
We create a storyboard for each item and then add all these storyboards to a global storyboard. Then if we want the carousel to turn, we just start the global storyboard.
History
- 23rd November, 2008: Initial post
- 26rd November, 2008: Fixed a bug in source code. When remove an item from the collection, it's will throw an exception, now fixed.
- 2nd August,2009, Updated the control to Silverlight V3.
My English is not very good so I hope you can understand what I've said. The sample code include some pictures from public web, you should not use the image in your product.
<!-- Main Page Contents End -->License
This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)
About the Author
cokkiy
Member |
The God created the world. The programer made the world easy. I am a programer like c# and c++, so I am writting application in it. Creating beautiful application make life easy. If you have a project and looking for a man, I'll be say "hi, I am just the man you are looking for."
|
Other popular Silverlight articles:
-
Legion: Build your own virtual super computer with Silverlight
Legion is a grid computing framework that uses the Silverlight CLR to execute user definable tasks. It provides grid-wide thread-safe operations for web clients. Client performance metrics, such as bandwidth and processor speed, may be used to tailor jobs. Also includes a WPF Manager application.
-
Silverlight 1.1 Fun and Games
Silverlight 1.1 Fun and Games
-
My First Data Application in Silverlight 2
A walkthrough of retrieving data from a database and consuming it in a Silverlight application.
-
Recreating Frogger in Silverlight
A tutorial on how to recreate a classic arcade game in Silverlight.
-
Silverlight Animations in a Practical Business Application
An article on building a practical business application using Silverlight animations
发表评论
-
SilverLight异步调用WebService出错!
2010-01-19 12:58 5394SilverLight异步调用WebService出错! ... -
Silverlight播放器 C#语言
2010-01-13 13:30 3292这段时间研究Silverlight中的MediaElement ... -
使用Silverlight,制作简单播放器的一点点心得。
2010-01-13 13:28 3646首先介绍什么是Silverligh ... -
初探silverlight--简易播放器
2010-01-13 13:28 1507<UserControl xmlns=" ... -
新开发的silverlight视频播放器,
2010-01-13 13:21 4476http://www.chenjiliang.com/Arti ... -
Silverlight教程第四部分:使用 Style 元素更好地封装观感
2010-01-12 22:11 1263Silverlight教程第四部分 ... -
Using projection to build a 3D carousel in Silverlight 3
2010-01-12 18:14 2322http://ww ... -
CoverFlow – built using Silverlight 3's 'Projection' feature
2010-01-12 18:11 1881CoverFlow – built using Silver ... -
silverlight动画播放停止重播等控制
2010-01-06 12:38 1379ani.begin() ani.stop(); ani. ... -
silverlight速学范例100
2010-01-06 12:37 1269silverlight速学范例100 ... -
Silverlight 中的 HTTP 通信和安全
2010-01-04 23:43 2001Silverlight 中的 HTTP 通信和安全 < ... -
Visual Studio的 诡异bug(mscorlib无法引用)引发的对话 and Silverlight XAML 构造出错
2010-01-04 09:25 4118... -
Silverlight常见问题及解决方法
2009-12-22 14:06 1268Silverlight常见问题及解决方法 ... -
网上常用免费webservice 查询
2009-12-22 12:47 4592网上常用免费webservice 查询 2008-11 ... -
必应 Bing 新特性之最新文章, Wolfram|Alpha 整合, 天气搜索等已推出
2009-12-21 23:33 1516必应 Bing 增加了一项“最新文章”的搜索结果特性,例如下图 ... -
下载silverlight官网的全部视频教程
2009-12-21 23:30 14846Silverlight官网提供了许 ... -
Silverlight客户端和WCF服务器端共享类库
2009-12-21 23:21 1825在Silverlight企业级项目开发中,访问数据库是很常见的 ... -
Create a Silverlight Europe weather map
2009-12-21 22:55 1581I don’t generally fi ... -
必应地图图片系统(Tile System)之二
2009-12-21 22:53 2313【坐标系和地图图片编 ... -
必应地图SilverLight控件入门讲座之六:显示街景(Streetside)
2009-12-21 22:51 4868必应地图SilverLight控件入门讲座之六:显示街景(St ...
相关推荐
安装npm i react react-dom @trendyol-js/react-carousel --save用法import React from 'react' ;import ReactDOM from 'react-dom' ;import { Carousel } from '@trendyol-js/react-carousel' ;import { Item } ...
如何在Magento2中使用OwlCarousel添加滑块? 下载此模块:V4U OwlCarousel 复制此模块并粘贴到magento-root / app / code文件夹中 运行以下命令: php bin / magento模块:状态 php bin / magento模块:启用V4U_...
:carousel_horse: 一个带有Next.js的简单轮播。 :joystick: 在这里测试: 即将推出... :hammer_and_wrench: 入门 视窗: 您可以通过键入以下命令通过CMD(命令提示符)克隆存储库: git clone ...
这是一个存储库,我在其中应用了一些 javascript 概念来进行研究。 我打算改进代码的幻灯片并使其更具活力,请随时贡献:) 运行应用程序: 安装 。 初始化竖琴服务器: $ harp server 您的应用程序将在 ...
用于RecyclerView的Android LayoutManager以支持Carousel视图样式示例与Gradle实现'com.azoft.carousellayoutmanager:carousel:version'的集成请用Android LayoutManager for RecyclerView来支持Carousel视图样式...
Flutter_Carosel 一个简单的带有多个配置选项的Carousel窗口小部件。 ...dependencies : ... flutter_multi_carousel : ^1.0.0... 并使用flutter packages get安装它,并将其放在您的项目文件夹中。 之后,只需导入...
"carousel:旋转木马"是关于网页开发中的一个组件,主要功能是展示一系列图标或图片,以轮播的形式呈现,通常用于网站的横幅、产品展示等区域,为用户提供动态浏览体验。这种组件的设计通常注重用户体验,使得内容...
目录安装npm install vue-carousel 或者如果您更喜欢纱线yarn add vue-carousel用法全球您可以全局安装Vue Carousel: import Vue from 'vue' ;import VueCarousel from 'vue-carousel' ;Vue . use ( VueCarousel ) ...
【标题】"carousel:Javascript 照片轮播" 涉及的核心技术是JavaScript,这是一种广泛用于网页动态效果和交互的编程语言。照片轮播,也称为旋转木马,是网页设计中常见的元素,用于展示一系列图片或内容,通常以滑动...
努卡旋转木马 纯ReactJS轮播组件 安装 要将nuka-carousel添加到您的项目...import Carousel from ' nuka-carousel ' ; export default class extends React.Component { render () { return ( < Carousel> < img
AyeTunes-轮播。 (iTunes 喜欢 Carousel) 视频在这里。 库免费的 javascript 模块,用于创建带有... carousel:'left', callbackfunc:cbFunction, sections:[ {id:'at0', sm:'img/PNG_S_0.png',lg:'img/PNG0.png
旋转木马使用JS编写的可访问轮播... button type =" button " data-pm-carousel-playstop =" Stop the carousel|Play the carousel " hidden > {text} </ button > < ul> < li> < button type =" button
import Carousel from "@jjunyjjuny/react-carousel"; const Container = styled.div` margin: 0 auto; margin-top: 100px; width: 480px; `; const Item = styled.div` background: #dbe4ff; text
**Angular Picture Carousel 演示详解** Angular Picture Carousel 是一个基于 AngularJS(也称为 Angular)框架的图片轮播组件,它允许开发者轻松地在网页应用中实现动态且交互性强的图片展示功能。AngularJS,...
【标题】"Images-Carousel:https"是一个与网页开发相关的项目,重点在于实现一个能够适应屏幕尺寸的图片轮播功能。在这个项目中,开发者利用了HTTPS(超文本传输安全协议)来确保数据在传输过程中的安全性,为用户...
总结来说,"Carousel:小程序应用"涉及到的知识点包括小程序的轮播组件`<swiper>`和`<swiper-item>`的使用,以及如何通过设置相关属性和监听事件来实现轮播功能。同时,也展示了小程序与HTML的关联,虽然不是直接使用...
总的来说,"video-carousel:视频播放统计"项目是基于Vue.js的前端开发实践,涉及到了组件化开发、事件驱动、数据统计、用户体验优化等多个方面的技术知识。这个项目不仅展示了Vue.js的强大功能,也体现了现代Web开发...
轮播 角度通用旋转木马Note: This carousel doesn't include any css. go and customize css for buttons, items except ngucarousel and ngucarousel-inner 演示版在Stackblitz演示可演示安装角版本ngu-carousel...
例子安装及使用通过npm安装: npm i react-spring-3d-carousel 或纱线: yarn add react-spring-3d-carousel 然后像这样导入Carousel组件: import Carousel from 'react-spring-3d-carousel'; 该组件唯一需要运行的...
=== 圆滑的旋转木马 === 贡献者:lloydwatkin 标签:carousel,slick 至少需要:4.0.0 稳定标签:trunk 许可证:MIT Wordpress 的轮播插件。 使用 carousel 库。简码选项所有这些选项也可以通过设置页面进行设置,...