Binding ZIndex from DataTemplate
问题 I have a View that is basically setup like this: <Grid> <ViewBox> <Grid> <ItemsControl ItemsSource="{Binding MyItems}" ItemTemplate="{Binding Source={StaticResource MyItemsDataTemplate}}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Grid /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> </Grid> </ViewBox> </Grid> The DataTemplate used here can be reduced to this: <DataTemplate x:Key="AreaItemDisplayDataTemplate"> <Canvas Grid.ZIndex={Binding Z}> <Grid> // an shape is