var h = ((Panel)Application.Current.MainWindow.Content).ActualHeight; var w = ((Panel)Application.Current.MainWindow.Content).ActualWidth;