Canvas 如何设置datatemplate的zindex';它在一个长的列表选择器中
我有一个带有特定图像的longlistselector,我在这个longlistselector中添加了这些图像。 我还更改了此图像的边距,使图像向上或向下,依此类推。 但是我想把这个图像放在这个长列表选择器中另一个图像的前面。我尝试过使用Canvas.Zindex。 我试过在网格级别、图像级别和longlistselector的顶层设置它,但仍然不起作用。有人有什么想法吗?您可以在下面找到我的代码:Canvas 如何设置datatemplate的zindex';它在一个长的列表选择器中,canvas,z-index,datatemplate,longlistselector,Canvas,Z Index,Datatemplate,Longlistselector,我有一个带有特定图像的longlistselector,我在这个longlistselector中添加了这些图像。 我还更改了此图像的边距,使图像向上或向下,依此类推。 但是我想把这个图像放在这个长列表选择器中另一个图像的前面。我尝试过使用Canvas.Zindex。 我试过在网格级别、图像级别和longlistselector的顶层设置它,但仍然不起作用。有人有什么想法吗?您可以在下面找到我的代码: <phone:LongListSelector x:Name="So
<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应该是相同的 我看不到您正在引用的画布,所以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>