Application.LoadComponent(Object,Uri)方法有什么用? [英] What is the use of Application.LoadComponent(Object, Uri) method ?

查看:126
本文介绍了Application.LoadComponent(Object,Uri)方法有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 Application.LoadComponent(Uri)的用法,但我无法理解其2参数兄弟的用法 Application.LoadComponent(Object,Uri).

I know the use of Application.LoadComponent(Uri), but I cannot understand the use of its 2 parameter brother Application.LoadComponent(Object, Uri).

单参数版本允许我执行此操作:

Single parameter version allows me to do this :

           窗口根= LoadComponent(新的Uri("Window4.xaml",UriKind.Relative))作为窗口;
           root.Show();

            Window root = LoadComponent(new Uri("Window4.xaml", UriKind.Relative)) as Window;
            root.Show();

Anjum S Khan管理员/分析师Blog.TrackNifty.com

Anjum S Khan Admin/Analyst Blog.TrackNifty.com

推荐答案

2参数版本不返回任何内容.

The 2 parameter version does not return anything.

相反,您必须传入对象(与XAML根类型相同)作为第一个参数,我认为它将从XAML初始化.

Instead you must pass in the object (of the same type as the XAML root) as the first parameter, which I presume will be initialised from the XAML.


这篇关于Application.LoadComponent(Object,Uri)方法有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆