private void cb_Click(object sender, RoutedEventArgs e) { var cb = sender as CheckBox; AppWindow.Topmost = (cb.IsChecked == true) ? true : false; AppWindow.Focus(); }