private void button1_Click(object sender, RoutedEventArgs e) { (sender as Button).ContextMenu.IsEnabled = true; (sender as Button).ContextMenu.PlacementTarget = (sender as Button); (sender as Button).ContextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom; (sender as Button).ContextMenu.IsOpen = true; LogIn.MainWindow login = new LogIn.MainWindow(); login.Owner = this; login.Show(); this.WindowState = WindowState.Normal; this.Activate(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.AppWindow = ((LogIn.MainWindow)(target)); return; case 2: this.MainFrame = ((System.Windows.Controls.Frame)(target)); return; } this._contentLoaded = true; }