2

我有以下 XAML,旨在将行号放在左列中,但得到输出的只是0

<ListBox 
VirtualizingPanel.VirtualizationMode="Recycling"
ItemsSource="{Binding MoineauPumpFlanks.Stator.Flank.Boundary, Mode=OneWay}"
   AlternationCount="2147483647"
   >
   <ListBox.ItemTemplate>
       <DataTemplate>
           <StackPanel Orientation="Horizontal">
               <TextBlock 
                   Text="{Binding RelativeSource={RelativeSource Mode=Self}, 
                                  Path=(ItemsControl.AlternationIndex)}"
                   Margin="0,0,5,0"
                   />

                <!-- A custom control of mine -->
               <Controls:LabelForPoint Point="{Binding}" />
           </StackPanel>
       </DataTemplate>
   </ListBox.ItemTemplate>
</ListBox>

有人可以建议这里有什么问题吗?

4

1 回答 1

1

下面做我想要的

<TextBlock Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, 
           Path=TemplatedParent.(ItemsControl.AlternationIndex)}"
    Margin="0,0,5,0"
    />
于 2013-07-30T12:32:30.097 回答