private void loaded(object sender, RoutedEventArgs e) { double w_width = this.Width; double w_height = this.Height; this.Left = PosUtil.GetAbsolutePlacement(this.Owner, true).Left + w_width / 2; this.Top = PosUtil.GetAbsolutePlacement(this.Owner, true).Top - w_height; }
private void showMenus(object sender, MouseButtonEventArgs e) { DockPanel panel = (DockPanel)sender; double p_width = panel.Width; double p_height = panel.Height; Menus menus = new Menus(); menus.WindowStartupLocation = WindowStartupLocation.Manual; menus.Left = PosUtil.GetAbsolutePlacement(panel, true).Left + p_width / 2 - menus.Width / 2; menus.Top = PosUtil.GetAbsolutePlacement(panel, true).Top + p_height / 2 - menus.Height / 2; this.Opacity = 0.8; menus.ShowDialog(); this.Opacity = 1; }