public void Initialize()
        {
            var parent = Parent;

            while (!(parent is GalleryView))
            {
                parent = LogicalTreeHelper.GetParent(parent);
            }

            galleryview = (GalleryView)parent;
        }
        private void ClosePopup(object sender, RoutedEventArgs e)
        {
            var parent = Parent;

            while (!(parent is GalleryView))
            {
                parent = LogicalTreeHelper.GetParent(parent);
            }

            galleryView = (GalleryView)parent;
            galleryView?.ClosePopUp();
        }