雨田博客
让斗志、坚持、自信成为习惯

导航

 
<!--主窗体,放置一个用户控件-->
<Window x:Class="WpfApplication.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wpfApplication="clr-namespace:WpfApplication" Title="MainWindow" Height="350" Width="525"> <Grid> <wpfApplication:UserControl1></wpfApplication:UserControl1> </Grid> </Window>
//用户控件
namespace
WpfApplication { /// <summary> /// UserControl1.xaml 的交互逻辑 /// </summary> public partial class UserControl1 : UserControl { public UserControl1() { InitializeComponent(); } private void UserControl1_OnLoaded(object sender, RoutedEventArgs e) {
       //为毛执行两次? StackTrace trace
= new StackTrace(); MessageBox.Show(trace.ToString()); } } }

 

posted on 2016-02-17 17:48  张雨田  阅读(4365)  评论(0编辑  收藏  举报