翻转视图中的图像叠加 [英] Image overlay in a flipview

查看:30
本文介绍了翻转视图中的图像叠加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个 XAML 代码:

I have this XAML code:

 <FlipView x:Name="models_list" Width="432" Height="286" Canvas.Left="89" Canvas.Top="80" ScrollViewer.VerticalScrollBarVisibility="Hidden" >
            <FlipView.ItemTemplate>
                <DataTemplate>
                    <Grid x:Name="imgGrid">
                        <Image x:Name="img1" Source = "{Binding}" Stretch="Fill" />
                        <Image x:Name="img2" Source = "{Binding}" Stretch="Fill" />
                    </Grid>
                </DataTemplate>
            </FlipView.ItemTemplate>
        </FlipView>

我希望能够在网格imgGrid"中的这个基本图像img1"上叠加图像.当我通过此代码将项目添加到翻转视图时,img1 会被填充:

I want to be able to overlay images on this basic image 'img1' in the grid 'imgGrid'. img1 gets populated when i add items to flipview through this code:

        foreach (StorageFile model in models)
        {
            models_list.Items.Add(new Uri("ms-appx:///Images/Models/" + model.Name));
        }

如何绑定 img2 以获取特定事件的值?

How can I bind img2 to get values on a specific event?

推荐答案

您似乎问错了问题.您只需在名为 img 的图像下方输入另一行,即可将另一个图像叠加在 img 之上.您也可以通过在 </FlipView> 行下方放置一个 Image 控件来实现.然后,您将使用其他项目绑定控制该叠加图像.

It seems like you might be asking the wrong question. You can overlay another image on top of img by just typing in another line below the Image named img. You can also do that by putting an Image control below the </FlipView> line. You would then control that overlaid image with additional item bindings.

如果您需要对单个 FlipViewItem 中的内容进行更多控制 - 您可以将整个 imgGrid Grid 放在 UserControl 中并将其放入DataTemplate 中的 UserControl.

If you need some more control over what's in a single FlipViewItem - you can put your entire imgGrid Grid in a UserControl and put that UserControl in the DataTemplate.

这篇关于翻转视图中的图像叠加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆