1
Answer

How to display AlternationIndex in ListBox

aadi kumary

aadi kumary

10y
931
1
Hi,
i want to display AlternationIndex in listbox , but in my code it's displaying only 0 always...
below is my code .. plz help me to display AlternationIndex.


<ListBox x:Name="listBox" AlternationCount="3">

<ListBox.ItemTemplate >
<DataTemplate >
<Canvas Margin="0,20,0,0">
<StackPanel Orientation="Vertical">
<TextBlock VerticalAlignment="Top" Text="{Binding Name }" FontSize="16" FontWeight="Bold" Margin="30,20,0,0" Foreground="Black" />
<TextBlock Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
Path=(ItemsControl.AlternationIndex)}" />

</StackPanel>
</Canvas>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>






nazeerpc
Answers (1)