首页 新闻 论坛 群组 Blog 文档 下载 读书 Tag 网摘 搜索 .NET Java 游戏 视频 人才 外包 第二书店 程序员
您的位置:软件2.0->silverlight 页面之间的导航汇总

silverlight 页面之间的导航汇总 2008-05-12 来自:java060515  [收藏到我的网摘]

1、 Silverlight: How to do navigation easily (Gill Cleeren)讲的是Silverlight 1.1中做页面导航

Here's a trick to a question I have heard a few times already: how to perform easy navigation in Silverlight 1.1?

我已经听过很多次关于如何在silverlight1.1中导航的技巧的问题?
This problem can be partially solved using hidden panels: you click on a button, Panel1 is hidden and Panel2 becomes visible. This is a trick that is often done in ASP.net too.

这个问题可以用隐藏panels(翻译成面板?)的方式实现,点一下按钮,面板1隐藏,面板2显示。这个技巧也经常被用在ASP.net中。
Well, this trick can also be done in Silverlight, using the Control class. This class makes it possible to have a piece of XAML that has been loaded dynamically, act as a Control, that can be shown or hidden to do navigation (or actually, fake navigation).

ok,这个技巧也可以用在Silverlight中,使用控件类。这个类可以动态加载一个XAML作为控件,然后显示或者隐藏实现导航的效果(其实是假的导航)。
Consider the following code. I have a panel, Panel1, that inherits from Control. Inside the constructor, XAML is read from a resource (ie, a XAML file).

考虑一下下面的代码,panel1继承自Control类。在panel1类的构造器中读取XAML资源。(例如:XAML文件)

public class Panel1 : Control
{

FrameworkElement myPanel;

Rectangle button;

public Panel1()

{

System.IO.Stream s = this.GetType().Assembly.GetManifestResourceStream("App1.MyPanel.xaml");

button = this.InitializeFromXaml(new System.IO.StreamReader(s).ReadToEnd());

button = (Rectangle)myPanel.FindName("button");

}

}
Now, in the main code behind page, we'll instantiate the constructor of the Panel1 class, and we'll add the controls it generates dynamically (from the XAML that is) to the existing XAML.

在主页的后台代码中,实例化这个Panel1并动态添加到已存在的XAML中。



Panel1 p = new Panel1();

this.Children.Add(p);


//If we later want to remove the panel, the following line does the trick.

this.Children.Remove(p);

- 傻样精英的园地 - 博客园
更详细信息,请点击查看原文。

推荐人评论

在网上搜了几个silverlight页面导航的几个帖子,在这里汇总一下。

用户评论

正在载入评论列表...

是谁推荐了此篇文章

专家头像付江CSDN频道编辑
个人blog发送信息
付江推荐的其他文章

热点新闻

热点评论

    视频访谈

    精彩专题

    
      网站简介广告服务网站地图帮助联系方式诚聘英才English问题报告
    北京世纪乐知数码科技有限公司  版权所有  京 ICP 证 020026 号
    北京创新乐知广告有限公司 提供技术支持
    Copyright © 2000-2006, CSDN.NET, All Rights Reserved