
Author Www i Author hsearchssearchfsearchn Lightsoffnow w Author w Admin easearchch Lightsoffnow 1 Www w Www
在这篇文章中我们将看到我们如何可以预览网页,而无需实际航行在Silverlight 4到它。
Create Silverlight Navigation Application创建Silverlight导航中的应用
Fire up Visual Studio 2010, and select Silverlight Business Application Project from the templates.启动Visual Studio 2010中,选择Silverlight的商业应用项目的模板。 Name the solution as PreviewSample .命名PreviewSample解决办法。
The template above will create two sample pages for you.上述模板将创建两个样品为您的网页。 Such as “Home” and “About Us”.如“家”和“关于我们”。
We would add a new page as “SlideShow.xaml”.我们将新增为“SlideShow.xaml”新的一页。
Let's add some images to the page for a mock of slide show.让我们添加了一些模拟的幻灯片图像页面。
The following image displays the Slideshow.xaml page.下面的图像显示Slideshow.xaml页面。
Now that our page is ready, let's add the link to the Application.现在,我们的页面已准备就绪,让我们添加到应用程序的链接。 Open MainPage.xaml and add the link there as follows.打开MainPage.xaml并添加链接有如下。
Now, we can test the application for the navigation purpose.现在,我们可以测试的航海提出申请。
Now we will add two events such as MouseEnter and MouseLeave to the Hyperlink Buttons in MainPage.xaml.现在我们将添加两个如的MouseEnter和MouseLeave事件中MainPage.xaml超链接的按钮。
As you see in above xaml display, Preview_On and Preview_Off are respective event handlers for MouseEnter and Mouse Leave.正如你看到的上面的XAML显示,Preview_On和Preview_Off是MouseEnter和鼠标离开各自的事件处理程序。
We would create a Border and a Popup element to display the Preview.我们将创建一个边框和弹出元素显示预览。
Now in Preview_On event, we can write the following code.现在,在Preview_On事件中,我们可以编写以下代码。
As you see in the above code display, we are sending the position of mouse and the HyperlinkButtons's NavigateUri property as a string to a method “CreatePreview”.正如你在上面的代码显示屏上看到,我们派出的鼠标位置和HyperlinkButtons的NavigateUri作为一种方法“CreatePreview”字符串属性。
In CreatePreview method we create a Frame and add that to the Popup and display.在CreatePreview方法中,我们创建一个框架,并添加到弹出式窗口和显示。
In the above code display, the Green blocked property is very much required otherwise you would not be able to see the mouse hovered link.在上面的代码显示,绿封锁是非常需要的财产,否则你将无法看到鼠标盘旋链接。
Let's run the application and see how it would look.让我们运行应用程序,看看它的样子。
That's it.就是这样。 Worked fine, you can add some good designs for the preview.工作得很好,你可以添加一些好的设计预览。 And for the user you can add a checkbox for preview on or off.而对于用户,你可以添加或关闭预览复选框。
Hope this article helps.希望这篇文章帮助。
本文来自ctrlhuhu的博客,原文地址:ctrlhuhu/blog/item/7b48002443b8b73cc995594d.html
在上几篇Silverlight Navigation导航框架教程中,主要介绍了Silverlight Navigation导...
在Silverlight实例教程 - 理解Navigation导航框架Frame类 介绍了Silverlight Navigati...
通过“Navigation导航框架开篇”的介绍,可以了解到Silverlight导航框架可被应用于多...
上一篇介绍了10个常用Expression Blend设计开发技巧,本篇将继续介绍Expression Blend...
微软Expression Blend是一款优秀的用户界面设计工具,该工具可被用于Silverlight,WPF...
银光中国网为方便大家学习Silverlight技术,特别推出Silverlight免费空间服务。看到论...