2014-03-03 72 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> 
相關問題