全景图和图像数组

发布于 2024-11-13 09:19:57 字数 3538 浏览 5 评论 0原文

所以我有一个编码问题需要帮助,简单地说我不知道​​我在做什么。仅供参考,我没有将工具包与手势监听器一起使用。

我有一个全景页面,其中包含 3 个全景项目:BigImageCenter、BigImageLeft、BigImageRight。

在我的应用程序中,有一堆图像将随应用程序一起下载。此全景页面的目标是在页面底部设置一个滚动查看器,以小缩略图形式显示应用程序附带的整个图像列表,并且页面的顶部是全景项目,如果您向左或向右滑动图像可以有条不紊地在列表中前进(如果向左滑动则返回)。

此外,如果您点击底部滚动查看器中的缩略图之一,它将用该缩略图替换当前的全景图像。如果您在全景页面上向左或向右滑动,您将在数组中得到该缩略图的 -1 或 +1。

您在页面上看到的第一张图片是 BigImageCenter。

我不必使用 3 个全景项目,而且我也许可以只使用 1 个。但是,当仅使用 1 个进行测试时,在我通过单击缩略图并向左或向右滑动全景来更改图像后,下一个即将加载到屏幕上的图像在更改之前始终是相同的图像(这是有道理的,因为我没有编写任何数组来动态更改下一个图像等)。

但是我不知道如何执行以下操作:

1)创建一个数组,其中全景项目中的第一个图像设置为 X。 2)判断用户是否向左或向右滑动到数组中的-1或+1 3) 设置点击时缩略图替换当前全景图像,然后将数组扔到该缩略图位置。

这是全景控件和缩略图滚动查看器的 XAML:

<Grid x:Name="ControlPanel" Grid.Row="1" Margin="-8,-22,-49,90">
        <controls:Panorama Name="Image_Panorama" Height="auto" Width="auto">
            <!--Panorama item one-->
            <controls:PanoramaItem>
                <Rectangle Height="auto" Width="auto" x:Name="BigImageCenter">
                    <Rectangle.Fill>
                        <ImageBrush ImageSource="image030.jpg" />
                    </Rectangle.Fill>
                </Rectangle>
            </controls:PanoramaItem>

            <controls:PanoramaItem>
                <Rectangle Height="auto" Width="auto" x:Name="BigImageLeft">
                    <Rectangle.Fill>
                        <ImageBrush ImageSource="pics/image002.jpg" />
                    </Rectangle.Fill>
                </Rectangle>
            </controls:PanoramaItem>


            <controls:PanoramaItem>
                <Rectangle Height="auto" Width="auto" x:Name="BigImageRight">
                    <Rectangle.Fill>
                        <ImageBrush ImageSource="pics/image003.jpg" />
                    </Rectangle.Fill>
                </Rectangle>
            </controls:PanoramaItem>


        </controls:Panorama>     
    </Grid>



<Grid x:Name="MiniPicturePanel" Grid.Row="1" Margin="0,390,0,0">
 <ScrollViewer x:Name="svSmall" Grid.Row="1" HorizontalContentAlignment="Center">
  <StackPanel x:Name="smallImages" Orientation="Horizontal" VerticalAlignment="Bottom" Margin="330,0,0,0">

     <Rectangle Height="70" Width="110" Margin="0,0,30,0" StrokeThickness="3" MouseLeftButtonUp="smallImage_Tap" Stroke="#FF004080" x:Name="Bat1">
                    <Rectangle.Fill>
                        <ImageBrush ImageSource="image030.jpg" />
                    </Rectangle.Fill>
                </Rectangle>


     <Rectangle Height="70" Width="110" Margin="0,0,30,0" StrokeThickness="3" MouseLeftButtonUp="smallImage_Tap" Stroke="#FF004080" x:Name="Bat2">
                    <Rectangle.Fill>
                        <ImageBrush ImageSource="pics\image002.jpg" />
                    </Rectangle.Fill>
                </Rectangle>

.... 等等

现在我已经完成了一些操作,但不是按照我想要的方式:

MouseLeftButtonUp="smallImage_Tap" 是一个函数,它将更改将“BigImageCenter”的全景项目填充到当前矩形的 image.fill 中。我只是无法对其进行编码来更改视图中的当前枢轴项目。我需要帮助。

private void smallImage_Tap(object sender, RoutedEventArgs e) {
    BigImageCenter.Fill = (sender as Rectangle).Fill;

如果您想知道为什么我使用矩形,这是我在点击较小的缩略图时使用后面的代码更改图像的最简单方法。

这几乎就是我的代码隐藏。我实际上是从头开始进行动态编码,并且需要一些帮助来实现这个梦想。

PS:我还需要知道与图像相关的数组编号,以便我可以允许用户“收藏”它并将其放置在另一个页面中。

So I have a coding problem I need help with, and simply put I have no idea what I am doing with this. FYI, I am not using the toolkit with the gesture listeners.

I have a panorama page with 3 panorama items: BigImageCenter, BigImageLeft, BigImageRight.

In my application are a bunch of images which will be downloaded with the app. The goal on this panorama page is to have a scrollviewer set at the bottom of the page to show the entire list of images that come with the app in little thumbnails, and the top part of the page to be the panorama items, where if you flick left or right the images methodically advance (or go back if flicking left) down the list.

Also, if you tap on one of the thumbnails in the bottom scrollviewer, it will replace that current panorama image with that thumbnail image. If you flick left or right on the panorama page, you will then get that thumbnail image's -1 or +1 in the array.

The first image you see on the page is BigImageCenter.

I do not have to use 3 panorama items, and I might be able to get away with just 1. However when testing it with just 1, after I change the image by clicking on a thumbnail and swiping the panorama left or right, the next image about to load on screen is always the same image before it was changed (makes sense, since I have not coded any array to dynamically change the next image, etc).

However I have no idea how to do any of the following:

1) Create an array where the first image in the panorama item is set to X.
2) Tell if the user flicked left or right to -1 or +1 in the array
3) Set the thumbnail image to replace the current panorama image when tapped, and then throw the array to that thumbnail image position.

Here is the XAML of both the panorama control and the thumbnail scrollviewer:

<Grid x:Name="ControlPanel" Grid.Row="1" Margin="-8,-22,-49,90">
        <controls:Panorama Name="Image_Panorama" Height="auto" Width="auto">
            <!--Panorama item one-->
            <controls:PanoramaItem>
                <Rectangle Height="auto" Width="auto" x:Name="BigImageCenter">
                    <Rectangle.Fill>
                        <ImageBrush ImageSource="image030.jpg" />
                    </Rectangle.Fill>
                </Rectangle>
            </controls:PanoramaItem>

            <controls:PanoramaItem>
                <Rectangle Height="auto" Width="auto" x:Name="BigImageLeft">
                    <Rectangle.Fill>
                        <ImageBrush ImageSource="pics/image002.jpg" />
                    </Rectangle.Fill>
                </Rectangle>
            </controls:PanoramaItem>


            <controls:PanoramaItem>
                <Rectangle Height="auto" Width="auto" x:Name="BigImageRight">
                    <Rectangle.Fill>
                        <ImageBrush ImageSource="pics/image003.jpg" />
                    </Rectangle.Fill>
                </Rectangle>
            </controls:PanoramaItem>


        </controls:Panorama>     
    </Grid>



<Grid x:Name="MiniPicturePanel" Grid.Row="1" Margin="0,390,0,0">
 <ScrollViewer x:Name="svSmall" Grid.Row="1" HorizontalContentAlignment="Center">
  <StackPanel x:Name="smallImages" Orientation="Horizontal" VerticalAlignment="Bottom" Margin="330,0,0,0">

     <Rectangle Height="70" Width="110" Margin="0,0,30,0" StrokeThickness="3" MouseLeftButtonUp="smallImage_Tap" Stroke="#FF004080" x:Name="Bat1">
                    <Rectangle.Fill>
                        <ImageBrush ImageSource="image030.jpg" />
                    </Rectangle.Fill>
                </Rectangle>


     <Rectangle Height="70" Width="110" Margin="0,0,30,0" StrokeThickness="3" MouseLeftButtonUp="smallImage_Tap" Stroke="#FF004080" x:Name="Bat2">
                    <Rectangle.Fill>
                        <ImageBrush ImageSource="pics\image002.jpg" />
                    </Rectangle.Fill>
                </Rectangle>

.... and so forth

Now I Have some things done, but not to the way I'd like:

MouseLeftButtonUp="smallImage_Tap" is a function which will change the panorama item for "BigImageCenter" to the current image.fill of the rectangle. I just cannot code it to change the current pivot item in view. I need help with that.

private void smallImage_Tap(object sender, RoutedEventArgs e) {
    BigImageCenter.Fill = (sender as Rectangle).Fill;

In case you are wondering why I am using rectangles, it was the easiest way for me to change the image with the code behind when tapping on the smaller thumbnail.

And that is pretty much my codebehind. I am literally doing this dynamic coding from scratch, and need some help achieving this dream.

PS: I also need to know the array number tied to the image so that I can allow the user to "Favorite" it and place it in another page.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

擦肩而过的背影 2024-11-20 09:19:57

我认为这会给您带来认证问题,即使您确实让它工作(假设我正确理解您)。这是全景图的非标准使用。

我认为更好的解决方案是使用手势的完全自定义控件......这并不难做到,并且您将完全控制演示文稿。这样做比破解全景图做你想做的事情要容易得多。

祝你好运,
约翰

I think this will cause you problems with certification, even if you do get it to work (assuming I'm understanding you correctly.) It's a non-standard use of the panorama.

I think a better solution is a fully custom control using gestures...it's not that difficult to do, and you'll have full control over the presentation. It'll be far easier to do this than hack the pano to do what you want.

Good luck,
John

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文