/// <summary> /// Called when the window is first opened. /// </summary> /// /// This function attempts to size and position the window /// appropriately on the desktop when it first opens. /// /// <param name="sender"></param> /// <param name="e"></param> /// private void Window_Loaded(object sender, RoutedEventArgs e) { TaskDefinitionWindow win = (TaskDefinitionWindow)sender; double width = win.Width; double height = win.Height; double desktopWidth = System.Windows.SystemParameters.PrimaryScreenWidth; double desktopHeight = System.Windows.SystemParameters.PrimaryScreenHeight; if (width > desktopWidth) { win.Width = desktopWidth * 0.80; win.Left = 20.0; } if (height > desktopHeight) { win.Height = desktopHeight * 0.90; win.Top = 20.0; } }
private void TasksBtn_Click(object sender, RoutedEventArgs e) { Window ww = new TaskDefinitionWindow(); ww.ShowDialog(); }