如何在longlistselector中设置datatemplate的zindex [英] How to set the the zindex of datatemplate's in a longlistselector

查看:136
本文介绍了如何在longlistselector中设置datatemplate的zindex的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个longlistselector与某些图像,我添加在这个longlistselector。
我也改变这个图像的边距,使图像上升或下降等。
但是我想把这个图像展示在这个longlistselector中的另一个图像。我试过使用Canvas.Zindex。
我试过设置它在网格级别,在图像级别和在顶级的longlistselector。()但它仍然不工作。有人有一些想法吗?您可以在下面找到我的代码:

I have a longlistselector with certain images that i add in this longlistselector. I also change the margins of this image to make the image go up or down and so on. But i want to put this image infront of another image in this longlistselector. I have tried using Canvas.Zindex. I have tried setting it at the grid level, at image level and at the top level of of the longlistselector.() But it still doesn't work. Does anybody have some idea's? You can find my code bellow:

  <phone:LongListSelector 

            x:Name="SouthLongListselector" 
            VerticalAlignment="Bottom"
            ItemsSource="{Binding Cards}"
            Canvas.ZIndex="{Binding Layer}"
            SelectionChanged="SouthLongListselector_SelectionChanged"   
            LayoutMode="Grid"
            GridCellSize="50,200" 
            Margin="0,0,0,-26"
            >

        <phone:LongListSelector.ItemTemplate >  
            <DataTemplate>
                <Grid
                    Background="Transparent" 
                    Margin="{Binding GridOffset}"
                    Height="150"
                    Width="110"                      
                    >
                    <!-- add image here-->
                    <Image 
                            Source="{Binding Image}"
                            >
                    </Image>

                </Grid>

            </DataTemplate>
        </phone:LongListSelector.ItemTemplate>                
    </phone:LongListSelector>

提前感谢,

推荐答案

我只使用了WPF,但xaml应该是一样的。

I have only used WPF but xaml should be the same.

我没有看到你的Canvas在任何地方引用Canvas。 ZIndex。所以我想你想要的是将列表的面板设置为一个画布,然后为列表中的时间设置Zindex。

I don't see your Canvas the you are referencing anywhere so Canvas.ZIndex. So I think what you want is to set the panel of the list to be a canvas and then set the Zindex for the times in the list.

<phone:LongListSelector.ItemsPanel>
    <ItemsPanelTemplate>
        <Canvas/>
    </ItemsPanelTemplate>
</phone:LongListSelector.ItemsPanel>
<phone:LongListSelector.ItemTemplate >  
        <DataTemplate>
            <Grid
                Canvas.ZIndex"{Binding Layer}"
                Background="Transparent" 
                Margin="{Binding GridOffset}"
                Height="150"
                Width="110"                      
                >
                <!-- add image here-->
                <Image 
                        Source="{Binding Image}"
                        >
                </Image>

            </Grid>

        </DataTemplate>
    </phone:LongListSelector.ItemTemplate>   

这篇关于如何在longlistselector中设置datatemplate的zindex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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