aadi kumary

aadi kumary

  • NA
  • 25
  • 19.4k

How to display AlternationIndex IN LISTBOX IN WPF

May 31 2014 6:41 AM

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