use*_*515 6 canvas z-index datatemplate longlistselector
我有一个longlistselector与我在这个longlistselector中添加的某些图像.我还更改了此图像的边距以使图像上下移动等等.但我想把这张图片放在这个longlistselector的另一张图片的前面.我尝试过使用Canvas.Zindex.我已经尝试在网格级别,图像级别和longlistselector的顶层设置它.()但它仍然无效.有人有想法吗?您可以在下面找到我的代码:
<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>
Run Code Online (Sandbox Code Playgroud)
提前致谢,
我只用过WPF,但xaml应该是一样的。
我没有看到您在任何地方引用的 Canvas,所以 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>
Run Code Online (Sandbox Code Playgroud)