datatemplate

Data template parameter

折月煮酒 提交于 2021-01-28 12:03:52
问题 There is list with columns to display. I am using ListView with data templates for cells. And my problem is to access both: row and column from template. Below is demo, xaml: <ListView x:Name="listView" ItemsSource="{Binding Items}"> <ListView.Resources> <GridViewColumn x:Key="Column" x:Shared="False"> <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock> <Run Text="{Binding WhatHere}" /> <!-- problem here --> <Run Text="{Binding Mode=OneWay}" /> </TextBlock> </DataTemplate> <

Binding ZIndex from DataTemplate

爱⌒轻易说出口 提交于 2020-08-25 03:52:08
问题 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