Silverlight 主页与页面用户组件中方法的调用顺序
2011-10-28 15:39
417 查看
主页:UseNewUserControlPage.xaml
<navigation:Page x:Class="UseUserControl.UseNewUserControlPage"
xmlns:newuc="clr-namespace:UseUserControl;assembly=UseUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
d:DesignWidth="640" d:DesignHeight="480"
Title="UseNewUserControlPage Page">
<Grid x:Name="LayoutRoot">
<newuc:NewConfrimBox Message="使用用户控件成功!"></newuc:NewConfrimBox>
</Grid>
</navigation:Page>
后台代码:
public UseNewUserControlPage()
{
InitializeComponent();
test2();
}
private void test2()
{
}
组件后台代码:
public NewConfrimBox()
{
InitializeComponent();
test1();
}
private void test1()
{
}
由于在主页中使用了用户控件NewConfrimBox,所以,编译执行时,先执行 UseNewUserControlPage{}方法中的InitializeComponent();方法,然后执行组件中的NewConfrimBox()方法,执行test1()方 法,最后,组件的构造方法执行完成后,再来执行主页的test2()方法,完成主页构造方法的执行。
<navigation:Page x:Class="UseUserControl.UseNewUserControlPage"
xmlns:newuc="clr-namespace:UseUserControl;assembly=UseUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
d:DesignWidth="640" d:DesignHeight="480"
Title="UseNewUserControlPage Page">
<Grid x:Name="LayoutRoot">
<newuc:NewConfrimBox Message="使用用户控件成功!"></newuc:NewConfrimBox>
</Grid>
</navigation:Page>
后台代码:
public UseNewUserControlPage()
{
InitializeComponent();
test2();
}
private void test2()
{
}
组件后台代码:
public NewConfrimBox()
{
InitializeComponent();
test1();
}
private void test1()
{
}
由于在主页中使用了用户控件NewConfrimBox,所以,编译执行时,先执行 UseNewUserControlPage{}方法中的InitializeComponent();方法,然后执行组件中的NewConfrimBox()方法,执行test1()方 法,最后,组件的构造方法执行完成后,再来执行主页的test2()方法,完成主页构造方法的执行。
相关文章推荐
- 同页面内【用户控件与父页面】以及【用户控件与用户控件】之间方法调用/传值 一点点经验
- 总结Silverlight与HTML页面交互基本方法(js调用Silverlight方法/属性)
- 在APP中嵌套H5页面,点击页面上的按钮调用app的组件方法
- ASP.NET同页面内【用户控件与父页面】以及【用户控件与用户控件】之间方法调用
- web用户控件调用.aspx页面里的方法
- 关于ASP.NET同页面内【用户控件与父页面】以及【用户控件与用户控件】之间方法调用/传值
- 怎样在用户控件中调用父页面中的方法
- C# aspx页面动态加载ascx用户控件 及 利用反射调用其内方法
- 用反射方法使用户控件动态调用父页面的方法
- 用反射方法使用户控件动态调用父页面的方法
- 关于ASP.Net页面上用户控件相互调用的方法
- 用户控件调用父页面方法
- web用户控件调用.aspx页面里的方法
- ASP.Net页面上用户控件相互调用的方法
- C# aspx页面动态加载ascx用户控件 及 利用反射调用其内方法
- 用反射方法使用户控件动态调用父页面的方法
- IE:页面调用IEWebBrowser,以及该组件的ExecWB方法
- 用户控件调用父页面方法
- 用户控件调用父页面的方法
- 进入页面立即调用该页面上用户控件ascx中方法