private void GenerateButton(ImagePair imagePair, int i, int position)
        {
            Grid grid = new Grid()
            {
                Margin  = new Thickness(0),
                Padding = new Thickness(0)
            };

            if (this.ShowMessages && this.MainOrientation == Orientation.Vertical)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(.5, GridUnitType.Star)
                });
                grid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(.5, GridUnitType.Star)
                });
                grid.ColumnSpacing = WIDTH_GRID_COLUMNSPACING;
            }

            Grid.SetRow(imagePair.NotSelected, 0);
            Grid.SetColumn(imagePair.NotSelected, 0);
            grid.Children.Add(imagePair.NotSelected);
            Grid.SetRow(imagePair.Selected, 0);
            Grid.SetColumn(imagePair.Selected, 0);
            grid.Children.Add(imagePair.Selected);

            HorizontalAlignment horizontalAlignment = HorizontalAlignment.Center;

            // if we need to show messages then align left
            if (this.MainOrientation == Orientation.Vertical && this.ShowMessages && !string.IsNullOrWhiteSpace(imagePair.Message))
            {
                horizontalAlignment = HorizontalAlignment.Left;
                TextBlockEx tbMessage = new TextBlockEx()
                {
                    Name              = "TheText",
                    Text              = imagePair.Message,
                    TextStyle         = TextStyles.AppSelectorText,
                    FontSize          = 20,
                    Opacity           = 1,
                    VerticalAlignment = VerticalAlignment.Center,
                    TextStyleBold     = TextStyles.AppSelectorTextBold
                };

                if (i == 0)
                {
                    tbMessage.ShowBoldText(true);
                }

                Grid.SetRow(tbMessage, 0);
                Grid.SetColumn(tbMessage, 1);// kk this isnt working just yet.
                grid.Children.Add(tbMessage);
            }

            AppSelectorButton sbButton = new AppSelectorButton()
            {
                ID = i,
                HorizontalAlignment = horizontalAlignment,
                VerticalAlignment   = VerticalAlignment.Center,
                Content             = grid
            };

            //if (!IsListView)
            //{
            //    sbButton.Background = new SolidColorBrush(Colors.Transparent);
            //}
            //else
            //{
            //    sbButton.NormalBackground = (i % 2 == 0 ? BackGroundWhiteAcrylic : BackGroundGrayAcrylic);
            //    if (i == 0)
            //    {
            //        sbButton.Background = new SolidColorBrush(Colors.Blue);
            //    }
            //    else
            //    {
            //        sbButton.Background = sbButton.NormalBackground;
            //    }

            //}

            //only set the dimensions of the button if the control variables are passed in
            // and the orientation is correct
            if (this.ButtonHeight > 0)
            {
                sbButton.Height = this.ButtonHeight;
            }

            // if u need to show messages, dont set the width b/c theres no way to figure out the width
            // if there is text
            if (this.ButtonWidth > 0 && (!this.ShowMessages && !(this.MainOrientation == Orientation.Vertical)))
            {
                sbButton.Width = this.ButtonWidth;
            }
            if (null != _buttonStyle)
            {
                sbButton.Style = _buttonStyle;
            }
            ;

            if (imagePair.IsClearButton)
            {// these buttons get their own handler and dont change the selection of the app selector
                sbButton.AddHandler(PointerReleasedEvent, new PointerEventHandler(Selector_ClearButtonClick), true);
            }
            else
            {
                sbButton.AddHandler(PointerReleasedEvent, new PointerEventHandler(Selector_ButtonClick), true);
            }
            grid.PointerEntered += pointerEntered;


            if (this.MainOrientation == Orientation.Horizontal)
            {
                Grid.SetRow(sbButton, 0);
                Grid.SetColumn(sbButton, position);
            }
            else // vertical
            {
                Grid.SetColumn(sbButton, 0);
                Grid.SetRow(sbButton, position);
            }
            if (!imagePair.IsClearButton)
            {// clear button is not a part of the regular buttons
                this.Buttons.Add(sbButton);
            }
            _layoutRoot.Children.Add(sbButton);
            _buttonList.Add(sbButton);
        }
        private void GenerateButton(AppSelectorData AppSelectorData, int index)
        {
            btnGrid = new Grid()
            {
                Margin  = new Thickness(0),
                Padding = new Thickness(0)
            };
            if (this.ShowMessages && this.MainOrientation == Orientation.Vertical)
            {
                btnGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(.5, GridUnitType.Star)
                });
                btnGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(.5, GridUnitType.Star)
                });
                btnGrid.ColumnSpacing = WIDTH_GRID_COLUMNSPACING;
            }

            ImagePair images = new ImagePair()
            {
                //ID = i,
                Selected = new Image()
                {
                    Width = this.ButtonWidth,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Opacity             = 1.0
                },
                NotSelected = new Image()
                {
                    Width = this.ButtonWidth,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Opacity             = 1.0
                }
            };

            if (!string.IsNullOrEmpty(AppSelectorData.Source_NotSelectedImage))
            {
                images.NotSelected.Source = new BitmapImage()
                {
                    UriSource = new Uri(AppSelectorData.Source_NotSelectedImage), DecodePixelWidth = (int)this.ButtonWidth
                };
            }
            else if (!string.IsNullOrEmpty(AppSelectorData.SourceSVG_NotSelectedImage))
            {
                images.NotSelected.Source = new SvgImageSource(new Uri(AppSelectorData.SourceSVG_NotSelectedImage));
            }

            if (!string.IsNullOrEmpty(AppSelectorData.Source_SelectedImage))
            {
                images.Selected.Source = new BitmapImage()
                {
                    UriSource = new Uri(AppSelectorData.Source_SelectedImage), DecodePixelWidth = (int)this.ButtonWidth
                };
            }
            else if (!string.IsNullOrEmpty(AppSelectorData.SourceSVG_SelectedImage))
            {
                images.Selected.Source = new SvgImageSource(new Uri(AppSelectorData.SourceSVG_SelectedImage));
            }
            //images.Selected.Source
            Grid.SetRow(images.NotSelected, 0);
            Grid.SetColumn(images.NotSelected, 0);
            btnGrid.Children.Add(images.NotSelected);
            Grid.SetRow(images.Selected, 0);
            Grid.SetColumn(images.Selected, 0);
            btnGrid.Children.Add(images.Selected);

            if (this.MainOrientation == Orientation.Vertical && this.ShowMessages)
            {
                TextBlockEx tbMessage = new TextBlockEx()
                {
                    Name              = "Text",
                    Text              = AppSelectorData.Message,
                    TextStyle         = TextStyles.AppSelectorText,
                    FontSize          = 20,
                    Opacity           = 1,
                    VerticalAlignment = VerticalAlignment.Center,
                    TextStyleBold     = TextStyles.AppSelectorTextBold
                                        //TextStyleBold = (IsListView ? TextStyles.AppSelectorTextDarkBold: TextStyles.AppSelectorTextBold)
                };

                if (index == 0)
                {
                    tbMessage.ShowBoldText(true);
                }

                Grid.SetRow(tbMessage, 0);
                Grid.SetColumn(tbMessage, 1);// kk this isnt working just yet.
                btnGrid.Children.Add(tbMessage);
            }
            if (!AppSelectorData.IsClearButton)
            {
                this.ImagePairs.Add(index, images);
            }

            HorizontalAlignment horizontalAlignment = HorizontalAlignment.Center;

            // if we need to show messages then align left
            if (this.MainOrientation == Orientation.Vertical && this.ShowMessages)
            {
                horizontalAlignment = HorizontalAlignment.Left;
            }

            AppSelectorButton sbButton = new AppSelectorButton()
            {
                ID                  = index,
                Background          = new SolidColorBrush(Colors.Transparent),
                HorizontalAlignment = horizontalAlignment,
                VerticalAlignment   = VerticalAlignment.Center,
                Content             = btnGrid
            };

            //if (!IsListView)
            //{
            //    sbButton.Background = new SolidColorBrush(Colors.Transparent);
            //}
            //else
            //{
            //    sbButton.NormalBackground = (index % 2 == 0 ? BackGroundWhiteAcrylic : BackGroundGrayAcrylic);
            //    if (index == 0)
            //    {
            //        sbButton.Background = new SolidColorBrush(Colors.Blue);
            //    }
            //    else
            //    {
            //        sbButton.Background = sbButton.NormalBackground;
            //    }

            //}

            //only set the dimensions of the button if the control variables are passed in
            // and the orientation is correct
            if (this.ButtonHeight > 0)
            {
                sbButton.Height = this.ButtonHeight;
            }

            // if u need to show messages, dont set the width b/c theres no way to figure out the width
            // if there is text
            if (this.ButtonWidth > 0 && (!this.ShowMessages && !(this.MainOrientation == Orientation.Vertical)))
            {
                sbButton.Width = this.ButtonWidth;
            }
            if (null != _buttonStyle)
            {
                sbButton.Style = _buttonStyle;
            }
            ;

            if (AppSelectorData.IsClearButton)
            {// these buttons get their own handler and dont change the selection of the app selector
                sbButton.AddHandler(PointerReleasedEvent, new PointerEventHandler(Selector_ClearButtonClick), true);
            }
            else
            {
                sbButton.AddHandler(PointerReleasedEvent, new PointerEventHandler(Selector_ButtonClick), true);
            }
            btnGrid.PointerEntered += pointerEntered;


            if (this.MainOrientation == Orientation.Horizontal)
            {
                Grid.SetRow(sbButton, 0);
                Grid.SetColumn(sbButton, index);
            }
            else // vertical
            {
                Grid.SetColumn(sbButton, 0);
                Grid.SetRow(sbButton, index);
            }
            if (!AppSelectorData.IsClearButton)
            {// clear button is not a part of the regular buttons
                this.Buttons.Add(sbButton);
            }
            _layoutRoot.Children.Add(sbButton);
            _buttonList.Add(sbButton);
        }