2014-03-03 70 views
6

我有一个longlistselector,并在这个longlistselector中添加了某些图像。 我也改变了这个图像的边缘,使图像上升或下降,等等。 但我想把这个图像infront的另一个图像在这个longlistselector。我曾尝试使用Canvas.Zindex。 我已经尝试在网格级别,图像级别和longlistselector的最高级别设置它()但它仍然不起作用。有人有一些想法吗?你可以找到波纹管我的代码:提前如何在longlistselector中设置datatemplate的zindex

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

感谢,

回答

1

我只用WPF XAML,但应该是相同的。

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

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