问题
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