3
Answers

Problem in DataGrid View in C# windows Application

Naeem Khan

Naeem Khan

9y
337
1
Hello friends,
 
i have one gridview and adding rows at run time when i click on button. what i want to do when i click on button row should be on top. for example if student name come in first row Naeem and 2nd Row Come Karthik now what i want when i add karthik it should be come on first not last .
last record should be selected and come on top.. is it possible then reply me ASAP..
 
thanks in advance
Answers (3)
0
aadi kumary
NA 12 10.9k 10y


Hi,

is their any way to display AlternationIndex ?


Below is my code this displaying 0 only ...




<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>

0
Khan Abrar Ahmed
NA 5.8k 200k 10y
Hi, check the image path
<Image Source="Images\Tiles\Folder-n-design(right).png" Name="imgLoadRight" Margin="0,10,0,0" Loaded="imgLoad_Loaded_1" Visibility="Collapsed" />
<Image Source="Images\Tiles\Folder-n-design(center).png" Name="imgLoadCenter" Margin="0,100,0,0" Loaded="imgLoad_Loaded_1" Visibility="Collapsed" />