コード例 #1
0
        private void Scenario2_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            bool isCurrentlySmall = e.NewSize.Width < 600;

            if (isSmall != isCurrentlySmall)
            {
                if (isCurrentlySmall)
                {
                    RelativePanel.SetBelow(tbOverview, imgPoster);
                    RelativePanel.SetAlignLeftWithPanel(tbOverview, true);
                    RelativePanel.SetAlignLeftWithPanel(gridInfo, true);
                    RelativePanel.SetBelow(grCast, gridInfo);
                    lvCredits.ItemTemplate = (DataTemplate)Application.Current.Resources["CastNarrowTemplate"];
                }
                else
                {
                    RelativePanel.SetAlignLeftWithPanel(tbOverview, false);
                    RelativePanel.SetAlignLeftWithPanel(gridInfo, false);
                    RelativePanel.SetBelow(tbOverview, tbTitle);
                    RelativePanel.SetRightOf(tbOverview, imgPoster);
                    RelativePanel.SetBelow(grCast, imgPoster);
                    lvCredits.ItemTemplate = (DataTemplate)Application.Current.Resources["CastWideTemplate"];
                }
                isSmall = isCurrentlySmall;
            }
        }
コード例 #2
0
        /// <summary>
        /// Создает, отрисовывает и добавляет в контейнер панель с информацией о контрагенте
        /// </summary>
        /// <param name="c"></param>
        private void AddContractorPanel(Contractor c)
        {
            RelativePanel panel           = new RelativePanel();
            Image         contractorImage = new Image();

            contractorImage.Source   = c.Photo ?? placeHolder;
            contractorImage.MaxWidth = contractorImage.MaxHeight = 50;
            contractorImage.Margin   = new Thickness(5, 5, 5, 5);
            TextBlock contractorName = new TextBlock();

            contractorName.Text = c.Name;
            contractorName.VerticalAlignment   = VerticalAlignment.Center;
            contractorName.HorizontalAlignment = HorizontalAlignment.Stretch;
            contractorName.TextWrapping        = TextWrapping.WrapWholeWords;
            RelativePanel.SetRightOf(contractorName, contractorImage);
            panel.Margin          = new Thickness(2, 5, 2, 5);
            panel.BorderBrush     = new SolidColorBrush(Colors.Black);
            panel.BorderThickness = new Thickness(3);
            panel.MaxHeight       = 60;
            panel.Width           = mainGrid.ColumnDefinitions[1].ActualWidth - panel.Margin.Right;
            panel.PointerPressed += contractorPressedEvent;
            panel.Tag             = c.ID;
            panel.Children.Add(contractorImage);
            panel.Children.Add(contractorName);
            panel.Background = new SolidColorBrush(Colors.White);
            RowDefinition newRow = new RowDefinition();

            newRow.MaxHeight = 70;
            contractorsList.RowDefinitions.Add(newRow);
            Grid.SetRow(panel, rowIndex++);
            contractorsList.Children.Add(panel);
        }
コード例 #3
0
        public void Lays_Out_1_Child_Next_the_other()
        {
            var rect1 = new Rectangle {
                Height = 20, Width = 20
            };
            var rect2 = new Rectangle {
                Height = 20, Width = 20
            };

            var target = new RelativePanel
            {
                VerticalAlignment   = Layout.VerticalAlignment.Top,
                HorizontalAlignment = Layout.HorizontalAlignment.Left,
                Children            =
                {
                    rect1, rect2
                }
            };

            RelativePanel.SetAlignLeftWithPanel(rect1, true);
            RelativePanel.SetRightOf(rect2, rect1);
            target.Measure(new Size(400, 400));
            target.Arrange(new Rect(target.DesiredSize));

            Assert.Equal(new Size(40, 20), target.Bounds.Size);
            Assert.Equal(new Rect(0, 0, 20, 20), target.Children[0].Bounds);
            Assert.Equal(new Rect(20, 0, 20, 20), target.Children[1].Bounds);
        }
コード例 #4
0
        private void KeyboardStandardLayout_DropDownClosed(object sender, object e)
        {
            if (this.CurrentlyEditingFnKey != null)
            {
                this.CurrentlyEditingFnKey.Visibility = Visibility.Visible;
                RelativePanel parent     = (RelativePanel)CurrentlyEditingFnKey.Parent;
                var           button_idx = parent.Children.IndexOf(CurrentlyEditingFnKey);
                if (button_idx != 0)
                {
                    RelativePanel.SetRightOf(CurrentlyEditingFnKey, parent.Children[parent.Children.IndexOf(CurrentlyEditingFnKey) - 1]);
                }
                if (button_idx != parent.Children.Count - 2)
                {
                    RelativePanel.SetRightOf(parent.Children[parent.Children.IndexOf(CurrentlyEditingFnKey) + 1], CurrentlyEditingFnKey);
                }
            }

            if (this.CurrentlyEditingStandardKey != null)
            {
                this.CurrentlyEditingStandardKey.Visibility = Visibility.Visible;
                RelativePanel parent     = (RelativePanel)CurrentlyEditingStandardKey.Parent;
                var           button_idx = parent.Children.IndexOf(CurrentlyEditingStandardKey);
                if (button_idx != 0)
                {
                    RelativePanel.SetRightOf(CurrentlyEditingStandardKey, parent.Children[parent.Children.IndexOf(CurrentlyEditingStandardKey) - 1]);
                }
                if (button_idx != parent.Children.Count - 2)
                {
                    RelativePanel.SetRightOf(parent.Children[parent.Children.IndexOf(CurrentlyEditingStandardKey) + 1], CurrentlyEditingStandardKey);
                }
            }

            this.keyboardLayoutSelection.Visibility = Visibility.Collapsed;
        }
コード例 #5
0
        /// <summary>
        /// Builds a relative panel containing the details of a voice memo
        /// </summary>
        /// <param name="voiceMemo">The voice memo to build the panel for</param>
        /// <param name="audioRecorder">The object that will play the voice memo's audio</param>
        /// <param name="DeleteCallBack">the callback function for when the voice memo's delete button is clicked</param>
        /// <returns></returns>
        public static RelativePanel BuildVoiceMemoPanel(VoiceMemo voiceMemo, AudioRecorder audioRecorder, Action DeleteCallBack = null)
        {
            var panel = new RelativePanel();

            panel.Margin = new Thickness(0, 10, 0, 10);
            var ellipse           = BuildMemoEllipse();
            var titleBlock        = BuildTitleBlock(voiceMemo);
            var durationBlock     = BuildDurationBlock(voiceMemo);
            var dateRecordedBlock = BuildDateRecordedBlock(voiceMemo);
            var deleteButton      = BuildDeleteButton(voiceMemo, audioRecorder, DeleteCallBack);
            var playbackButton    = BuildPlayBackButton(voiceMemo, audioRecorder);

            panel.Children.Add(ellipse);
            panel.Children.Add(titleBlock);
            panel.Children.Add(durationBlock);
            panel.Children.Add(dateRecordedBlock);
            panel.Children.Add(deleteButton);
            panel.Children.Add(playbackButton);
            // position the elements within the panel
            RelativePanel.SetRightOf(titleBlock, ellipse);
            RelativePanel.SetAlignVerticalCenterWith(titleBlock, ellipse);
            RelativePanel.SetBelow(durationBlock, titleBlock);
            RelativePanel.SetAlignLeftWith(durationBlock, titleBlock);
            RelativePanel.SetBelow(dateRecordedBlock, durationBlock);
            RelativePanel.SetAlignLeftWith(dateRecordedBlock, durationBlock);
            RelativePanel.SetBelow(deleteButton, dateRecordedBlock);
            RelativePanel.SetAlignBottomWithPanel(deleteButton, true);
            RelativePanel.SetAlignLeftWithPanel(deleteButton, true);
            RelativePanel.SetBelow(playbackButton, dateRecordedBlock);
            RelativePanel.SetAlignBottomWithPanel(playbackButton, true);
            RelativePanel.SetAlignRightWithPanel(playbackButton, true);
            return(panel);
        }
コード例 #6
0
        private async void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                StackPanel stackPanel = new StackPanel();

                TextBlock NameOfStyle = new TextBlock
                {
                    Text   = "Название стиля",
                    Margin = new Thickness(10)
                };

                TextBox NameOfStyleTextBlock = new TextBox
                {
                    MaxLength = 255
                };

                RelativePanel relativePanel = new RelativePanel
                {
                    FlowDirection       = FlowDirection.LeftToRight,
                    HorizontalAlignment = HorizontalAlignment.Stretch
                };
                relativePanel.Children.Add(NameOfStyle);
                relativePanel.Children.Add(NameOfStyleTextBlock);
                RelativePanel.SetAlignLeftWithPanel(NameOfStyle, true);
                RelativePanel.SetAlignRightWithPanel(NameOfStyleTextBlock, true);
                RelativePanel.SetRightOf(NameOfStyleTextBlock, NameOfStyle);
                stackPanel.Children.Add(relativePanel);

                ContentDialog deleteFileDialog = new ContentDialog()
                {
                    Title               = "Подтверждение действия",
                    Content             = stackPanel,
                    PrimaryButtonText   = "ОК",
                    MaxWidth            = 500,
                    SecondaryButtonText = "Отмена"
                };

                ContentDialogResult result = await deleteFileDialog.ShowAsync();

                if (result == ContentDialogResult.Primary)
                {
                    await _styleService.CreateStyle(NameOfStyleTextBlock.Text);

                    (DataContext as ApplicationViewModel).Styles = await _styleService.GetAllStyles();
                }
                else if (result == ContentDialogResult.Secondary)
                {
                    //header.Text = "Отмена действия";
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"Message: {ex.Message}\r\nSource: { ex.Source}\r\nTarget Site Name: { ex.TargetSite.Name}\r\n{ ex.StackTrace}");
            }
        }
コード例 #7
0
 // often crash in xaml desigher when using visualstateManager to change the relativePanel properties
 // so put the resoponse logic to the sizeChanged
 private void PlayingView_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (e.NewSize.Width >= (double)App.Current.Resources["MediumWindowSnapPoint"])
     {
         RelativePanel.SetRightOf(this.lyricsGrid, this.playerGrid);
         RelativePanel.SetBelow(this.lyricsGrid, null);
     }
     else
     {
         RelativePanel.SetRightOf(this.lyricsGrid, null);
         RelativePanel.SetBelow(this.lyricsGrid, this.playerGrid);
     }
 }
コード例 #8
0
 private void MenuClick(object sender, RoutedEventArgs e)
 {
     if (MenuFlyout.Visibility == Visibility.Visible)
     {
         MenuFlyout.Visibility = Visibility.Collapsed;
         //If MenuFlyout is collaped, we want to align the frame with the BackButton to prevent overlapping of elements
         RelativePanel.SetRightOf(MainFrame, BackButton);
         return;
     }
     MenuFlyout.Visibility = Visibility.Visible;
     //If MenuFlyout is visible, we want to align the frame with the MenuFlyout to prevent overlapping of elements
     RelativePanel.SetRightOf(MainFrame, MenuFlyout);
 }
コード例 #9
0
        private void MyUserControl1_VisibleBoundsChanged(Windows.UI.ViewManagement.ApplicationView sensor, object args)
        {
            var Width = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().VisibleBounds.Width;

            if (Width >= 500)
            {
                RelativePanel.SetRightOf(boxtest, texttest);
                RelativePanel.SetBelow(testButon, texttest);
            }
            else
            {
                RelativePanel.SetRightOf(boxtest, texttest);
                RelativePanel.SetBelow(testButon, texttest);
                RelativePanel.SetAlignBottomWith(boxtest, texttest);
            }
        }
コード例 #10
0
        private void updateUsedFiltersPanel()
        {
            Button prevBtn = null;
            int    counter = 0;

            UsedFilters_Panel.Children.Clear();

            foreach (var filter in filtersStack.getFilters())
            {
                // update usedFiltersPanel
                Button but = new Button()
                {
                    Name    = "filter_" + counter + "_" + filter.getName(),
                    Content = filter.getName().Substring(0, 1),
                    Style   = (Style)this.Resources["UsedFilter"]
                };
                but.Click += removeUsedFilter_Click;

                if (prevBtn != null)
                {
                    RelativePanel.SetRightOf(but, prevBtn);
                }

                UsedFilters_Panel.Children.Add(but);

                if (filter.GetType() == typeof(MatrixFilter))
                {
                    Match mat_dim = Regex.Match(filter.getName(), "_(.*)$");

                    TextBlock tb_mat = new TextBlock()
                    {
                        Text  = mat_dim.Groups[1].Value,
                        Style = (Style)this.Resources["UsedFilter_matrix"]
                    };

                    RelativePanel.SetAlignRightWith(tb_mat, but);
                    RelativePanel.SetAlignBottomWith(tb_mat, but);

                    UsedFilters_Panel.Children.Add(tb_mat);
                }



                prevBtn = but;
                counter++;
            }
        }
コード例 #11
0
        private void UcRatingText_VisibleBoundsChanged(Windows.UI.ViewManagement.ApplicationView sender, object args)
        {
            var Width = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().VisibleBounds.Width;

            if (Width >= 360)
            {
                RelativePanel.SetBelow(tbTexto, null);
                RelativePanel.SetRightOf(tbTexto, rcStars);
                RelativePanel.SetAlignVerticalCenterWith(tbTexto, rcStars);
                RelativePanel.SetAlignVerticalCenterWithPanel(rcStars, true);
            }
            else
            {
                RelativePanel.SetRightOf(tbTexto, null);
                RelativePanel.SetBelow(tbTexto, rcStars);
                RelativePanel.SetAlignVerticalCenterWith(tbTexto, null);
                RelativePanel.SetAlignVerticalCenterWithPanel(rcStars, false);
            }
        }
コード例 #12
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            // Check if Boo is right of Kevin
            var theRightStuff = RelativePanel.GetRightOf(Stuart);

            // We'll check for Boo, not Kevin
            // The first call this returns the string "Kevin", only later it returns the Image "Kevin".

            // Historic C#
            // if (theRightStuff is Image && ((String)((Image)theRightStuff).Tag) == "Boo") //

            // New C#
            if ((theRightStuff as Image)?.Tag?.ToString() == "Boo")
            {
                // Remove Boo
                RelativePanel.SetRightOf(Stuart, Kevin);
                MinionPanel.Children.Remove((UIElement)theRightStuff);
            }
            else
            {   // Insert Boo
                var boo = new Image()
                {
                    Source = new BitmapImage(new Uri("ms-appx:/Assets/Boo.png")),
                    Width  = 300,
                    Tag    = "Boo"
                };

                // Prepare Boo
                RelativePanel.SetRightOf(boo, Kevin);
                RelativePanel.SetAlignBottomWith(boo, Kevin);

                // Add Boo
                MinionPanel.Children.Add(boo);

                // Link to Stuart
                // Don't do this - it does not draw Boo (Stuart still has RightOf Kevin):
                // RelativePanel.SetLeftOf(boo, Stuart);

                // Override the graph edge:
                RelativePanel.SetRightOf(Stuart, boo);
            }
        }
コード例 #13
0
        private void FavorityUC_VisibleBoundsChanged(ApplicationView sender, object args)
        {
            var width = ApplicationView.GetForCurrentView().VisibleBounds.Width;

            if (width >= 360)
            {
                //VisualStateManager.GoToState(this, "Width360", false);
                RelativePanel.SetBelow(FavText, null);
                RelativePanel.SetRightOf(FavText, Stars);
                RelativePanel.SetAlignVerticalCenterWith(FavText, Stars);
            }
            else
            {
                //VisualStateManager.GoToState(this, "Width0", false);
                RelativePanel.SetRightOf(FavText, null);
                RelativePanel.SetBelow(FavText, Stars);

                RelativePanel.SetAlignVerticalCenterWith(FavText, null);
                RelativePanel.SetAlignVerticalCenterWithPanel(Stars, false);
            }
        }
コード例 #14
0
        private void MyUserControl1_VisibleBoundsChanged(Windows.UI.ViewManagement.ApplicationView sender, object args)
        {
            var width = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().VisibleBounds.Width;

            if (width >= 360)
            {
                RelativePanel.SetBelow(FavText, null);
                RelativePanel.SetRightOf(FavText, Stars);

                RelativePanel.SetAlignVerticalCenterWith(FavText, Stars);
                RelativePanel.SetAlignVerticalCenterWithPanel(Stars, true);
            }
            else
            {
                RelativePanel.SetBelow(FavText, null);
                RelativePanel.SetRightOf(FavText, Stars);

                RelativePanel.SetAlignVerticalCenterWith(FavText, null);
                RelativePanel.SetAlignVerticalCenterWithPanel(Stars, false);
            }
        }
コード例 #15
0
ファイル: RemindersPage.xaml.cs プロジェクト: ploiu/Bob
        private void AddReminderToScreen(Reminder ReminderToAdd)
        {
            // each Reminder is wrapped in a relative panel
            RelativePanel ReminderPanel = new RelativePanel();

            ReminderPanel.Margin = new Thickness(5, 0, 5, 5);
            var borderBrush = new SolidColorBrush(Windows.UI.Colors.Gray);

            ReminderPanel.BorderBrush     = borderBrush;
            ReminderPanel.BorderThickness = new Thickness(1);
            // create the text blocks for the title and date
            var ReminderTitleBlock       = this.CreateReminderTitleBlock(ReminderToAdd);
            var ReminderDateBlock        = this.CreateReminderDateBlock(ReminderToAdd);
            var ReminderDescriptionBlock = this.CreateDescriptionBlock(ReminderToAdd);
            var deleteButton             = this.CreateDeleteButton(ReminderToAdd);
            var editButton = this.CreateEditButton(ReminderToAdd);

            // add the blocks and buttons
            ReminderPanel.Children.Add(ReminderTitleBlock);
            ReminderPanel.Children.Add(ReminderDateBlock);
            ReminderPanel.Children.Add(ReminderDescriptionBlock);
            ReminderPanel.Children.Add(deleteButton);
            ReminderPanel.Children.Add(editButton);
            // relatively place the edit text block
            RelativePanel.SetRightOf(ReminderDateBlock, ReminderTitleBlock);
            RelativePanel.SetAlignRightWithPanel(ReminderDateBlock, true);
            // relatively place the description block
            RelativePanel.SetBelow(ReminderDescriptionBlock, ReminderTitleBlock);
            // relatively place the delete button
            RelativePanel.SetAlignBottomWithPanel(deleteButton, true);
            RelativePanel.SetAlignLeftWithPanel(deleteButton, true);
            RelativePanel.SetBelow(deleteButton, ReminderDescriptionBlock);
            RelativePanel.SetLeftOf(deleteButton, editButton);
            // relatively place the edit button
            RelativePanel.SetAlignBottomWithPanel(editButton, true);
            RelativePanel.SetAlignRightWithPanel(editButton, true);
            RelativePanel.SetBelow(editButton, ReminderDescriptionBlock);
            this.VariableGrid.Children.Add(ReminderPanel);
        }
コード例 #16
0
        private async void KeyboardLayoutButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.CurrentlyEditingFnKey != null)
            {
                this.CurrentlyEditingFnKey.Visibility = Visibility.Visible;
                this.CurrentlyEditingFnKey            = null;
            }

            if (this.CurrentlyEditingStandardKey != null)
            {
                this.CurrentlyEditingStandardKey.Visibility = Visibility.Visible;
                this.CurrentlyEditingStandardKey            = null;
            }

            Button button = (Button)sender;

            bool fn_mode = button.Name.StartsWith("keyboardFNLayoutButton");

            if (fn_mode)
            {
                this.CurrentlyEditingFnKey = button;
            }
            else
            {
                this.CurrentlyEditingStandardKey = button;
            }

            // Switch parents
            RelativePanel selector_parent = (RelativePanel)keyboardLayoutSelection.Parent;

            selector_parent.Children.Remove(keyboardLayoutSelection);

            //add the combobox to relative panel and place it into the correct position
            RelativePanel parent = (RelativePanel)button.Parent;

            parent.Children.Add(keyboardLayoutSelection);
            var button_idx = parent.Children.IndexOf(button);
            var width      = button.Width + 1;

            if (button_idx != 0)
            {
                RelativePanel.SetRightOf(keyboardLayoutSelection, parent.Children[parent.Children.IndexOf(button) - 1]);
            }
            else
            {
                RelativePanel.SetRightOf(keyboardLayoutSelection, null);
                width += 1;
            }
            if (button_idx != parent.Children.Count - 2) //added combobox, account for it here
            {
                RelativePanel.SetRightOf(parent.Children[parent.Children.IndexOf(button) + 1], keyboardLayoutSelection);
            }
            keyboardLayoutSelection.Width         = width; //account for 1px between buttons
            keyboardLayoutSelection.SelectedIndex = this.KeyboardKeyLabels.IndexOf((string)button.Content);

            button.Visibility = Visibility.Collapsed;

            keyboardLayoutSelection.Visibility = Visibility.Visible;

            // hack to have combobox be shown
            await Task.Delay(50);

            keyboardLayoutSelection.IsDropDownOpen = true;
        }
コード例 #17
0
        private async void AddButtons()
        {
            int tabIndex = 1;

            count++;
            var style = new Style();

            style       = (Style)Application.Current.Resources["ProjButton"];
            DataContext = this;

            //Remove Program Buttons
            foreach (Button b in ButtonPanel.Children)
            {
                if (b.Name != addNewButton.Name)
                {
                    ButtonPanel.Children.Remove(b);
                }
            }
            addNewButton.TabIndex = 99;

            //Add Buttons
            if (Globals.projects != null)
            {
                foreach (var project in Globals.projects)
                {
                    int numTasks = 0;

                    if (project != null)
                    {
                        foreach (var t in Globals.tasks)
                        {
                            if ((t.projectName == project.projectName) && (t.projCompleted == false))
                            {
                                numTasks++;
                            }
                        }
                        RelativePanel panel = new RelativePanel
                        {
                            Margin = new Thickness(0, 105, 0, 0),
                            Width  = 130,
                            Height = 25,
                        };
                        TextBlock blockName = new TextBlock
                        {
                            Text          = project.projectName,
                            TextAlignment = TextAlignment.Center,
                            TextWrapping  = TextWrapping.Wrap,
                            FontSize      = 10,
                            Margin        = new Thickness(25, 0, 0, 0),
                            Width         = 80,
                        };
                        RelativePanel.SetAlignLeftWithPanel(blockName, true);
                        panel.Children.Add(blockName);
                        if (numTasks != 0)
                        {
                            TextBlock blockTasks = new TextBlock
                            {
                                Text          = numTasks.ToString(),
                                TextAlignment = TextAlignment.Center,
                                Margin        = new Thickness(-1, 2, 0, 0),
                                FontSize      = 10,
                                Width         = 20,
                            };
                            Brush   shapeColor = Application.Current.Resources["SystemControlHighlightAccentBrush"] as SolidColorBrush;
                            Ellipse shape      = new Ellipse
                            {
                                Width  = 20,
                                Height = 20,
                                Fill   = shapeColor,
                            };
                            RelativePanel.SetAlignRightWithPanel(shape, true);
                            RelativePanel.SetAlignRightWithPanel(blockTasks, true);
                            panel.Children.Add(shape);
                            panel.Children.Add(blockTasks);
                        }

                        Button newButton = new Button
                        {
                            Name       = project.projectName.Replace(" ", "") + "Button",
                            Content    = panel,
                            Foreground = new SolidColorBrush(Windows.UI.Colors.White),
                            Width      = 150,
                            Height     = 150,
                            Margin     = new Thickness(5),
                            TabIndex   = tabIndex,
                            Style      = style,
                        };
                        newButton.Click += ProjectButton_Click;
                        if (tabIndex <= 5)
                        {
                            if (tabIndex == 1)
                            {
                                RelativePanel.SetAlignTopWithPanel(newButton, true);
                                RelativePanel.SetAlignLeftWithPanel(newButton, true);
                            }
                            else
                            {
                                RelativePanel.SetAlignTopWithPanel(newButton, true);
                                RelativePanel.SetRightOf(newButton, ButtonPanel.Children[tabIndex - 1]);
                            }
                        }
                        if ((tabIndex > 5) && (tabIndex <= 10))
                        {
                            if (tabIndex == 6)
                            {
                                RelativePanel.SetBelow(newButton, ButtonPanel.Children[1]);
                                RelativePanel.SetAlignLeftWithPanel(newButton, true);
                            }
                            else
                            {
                                RelativePanel.SetBelow(newButton, ButtonPanel.Children[1]);
                                RelativePanel.SetRightOf(newButton, ButtonPanel.Children[tabIndex - 1]);
                            }
                        }
                        if ((tabIndex > 10) && (tabIndex <= 14))
                        {
                            if (tabIndex == 11)
                            {
                                RelativePanel.SetAlignBottomWithPanel(newButton, true);
                                RelativePanel.SetAlignLeftWithPanel(newButton, true);
                            }
                            else
                            {
                                RelativePanel.SetBelow(newButton, ButtonPanel.Children[6]);
                                RelativePanel.SetRightOf(newButton, ButtonPanel.Children[tabIndex - 1]);
                            }
                        }
                        //					if (tabIndex > 14)
                        //					{
                        //						MessageDialog dialog = new MessageDialog("Max Projects Reached", "Max Projects Reached");/////
                        //
                        //						await dialog.ShowAsync();
                        //					}
                        var backImg = new ImageBrush();
                        if ((project.imgSource != "") && (project.imgSource != null))
                        {
                            StorageFile imageFile = await StorageFile.GetFileFromPathAsync(project.imgSource);

                            var img = new BitmapImage();
                            using (var stream = await imageFile.OpenAsync(FileAccessMode.Read))
                            {
                                img.SetSource(stream);
                            }
                            backImg.ImageSource  = img;
                            backImg.Stretch      = Stretch.None;
                            backImg.AlignmentY   = AlignmentY.Top;
                            backImg.AlignmentX   = AlignmentX.Center;
                            backImg.Opacity      = .75;
                            newButton.Background = backImg;
                        }
                        ButtonPanel.Children.Add(newButton);
                        tabIndex++;
                    }
                }
            }
        }