private void btnNew_Click(object sender, RoutedEventArgs e) { if (gMain.Children.Count == 0) { return; } BaseUserControl baseUserControl = gMain.Children[0] as BaseUserControl; baseUserControl.NewFile(sender, e); }