private void InitializeFlashCard() { _flashCardView = new FlashCardView(); _flashCardView.Topmost = true; _flashCardView.ShowActivated = false; //this.Left }
private void BtnShowAll_Click(object sender, RoutedEventArgs e) { if (_listFlashCardView == null) { _listFlashCardView = new List <FlashCardView>(); var desktopWorkingArea = System.Windows.SystemParameters.WorkArea; int columnNumber = (int)(desktopWorkingArea.Width / _flashCardView.ActualWidth); int rowNumber = (int)(desktopWorkingArea.Height / _flashCardView.ActualHeight); double leftStartPostion = (desktopWorkingArea.Width - (columnNumber * _flashCardView.ActualWidth)) / 2; double topStartPostion = (desktopWorkingArea.Height - (rowNumber * _flashCardView.ActualHeight)) / 2; for (int i = 0; i < rowNumber; i++) { for (int j = 0; j < columnNumber; j++) { FlashCardView card = new FlashCardView(); card.Owner = this; card.Left = leftStartPostion + _flashCardView.ActualWidth * j; card.Top = topStartPostion + _flashCardView.ActualHeight * i; _listFlashCardView.Add(card); } } } foreach (var card in _listFlashCardView) { card.ShowDialog(); } }