Image overlay in a flipview

丶灬走出姿态 提交于 2019-12-25 01:35:26

问题


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>

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));
        }

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


回答1:


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.

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.



来源:https://stackoverflow.com/questions/15583816/image-overlay-in-a-flipview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!