18、Silverlight应用开发:页面管理、闪屏与资源使用全解析

Silverlight应用开发:页面管理、闪屏与资源使用全解析

1. 页面实例创建与根视觉设置

在Silverlight应用开发中,页面实例的创建是一个基础操作。以下代码展示了如何创建页面实例并设置根视觉:

try
{
    // Create an instance of the page.
    Type type = this.GetType();
    Assembly assembly = type.Assembly;
    startPage = (UserControl)assembly.CreateInstance(
        type.Namespace + "." + startPageName);
}
catch
{
    startPage = null;
}

// If no parameter was supplied or the class couldn't be created, use a default.
if (startPage == null) startPage = new MenuPage();
this.RootVisual = startPage;

上述代码首先尝试通过反射创建指定名称的页面实例。若创建失败, startPage 将被置为 null ,此时会使用默认的 MenuPage 作为起始页面,并将其设置为应用的根视觉。

2. 页面切换

当应用加载完成后,直接更改 RootVisu

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值