Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I used the blow mentioned code. When i am trying to select a row, its not getting selected. Please let me know the mistake i did.

<DataGrid Name="DG_FollowUp" AutoGenerateColumns="False" SelectionMode="Single" SelectedIndex="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="01" BorderBrush="Black" BorderThickness="0.5" LoadingRow="DG_FollowUp_LoadingRow" IsEnabled="True" CanUserAddRows="false">
<datagrid.columns>
<DataGridTextColumn Binding="{Binding EntryID}" Header="Entry ID" Width="75">
<datagridtextcolumn.elementstyle>

&lt;Setter Property="HorizontalAlignment" Value='Center'/>



<DataGridTextColumn Binding="{Binding [TicketID/Subject]}" Header="TicketID/Subject" Width="330" CanUserSort="False"/>
<DataGridTextColumn Binding="{Binding [AddDate]}" Header="Start Date" Width="90" CanUserSort="False">
<DataGridTextColumn Binding="{Binding [Status]}" Header="Status" Width="130" CanUserSort="False">
<DataGridTextColumn Binding="{Binding [OwnerShip]}" Header="Ownership" Width="130" CanUserSort="False">
<DataGridTextColumn Binding="{Binding [Comments]}" Header="Comments" Width="300" CanUserSort="False">
<DataGridTextColumn Binding="{Binding [SLA DATE]}" Header="SLA Date" Width="90" CanUserSort="False">
<DataGridCheckBoxColumn Header="Strike1" Width="70" CanUserSort="False">
<DataGridCheckBoxColumn Header="Strike2" Width="70" CanUserSort="False">
<DataGridCheckBoxColumn Header="Strike3" Width="70" CanUserSort="False">




I am binding data to the above grid by reading from SQLDB.

What I have tried:

i tried using IsEnabled= "true", Selectionmode="Single" and also with giving selectedIndex=0, None of them were working.
Posted
Updated 31-Jan-17 1:32am
v4

1 solution

Add an event handler for SelectionChanged, and set a breakpoint in the event handler method.

Run the app, and select an item. If the breakpoint is hit, the item is being selected. If this is the case, try adding a call to UpdateLayout() in the event handler.
 
Share this answer
 
v2
Comments
VamsiPenta 31-Jan-17 7:49am    
It didnt worked but anyway it helped me to sort the mistake i commited. Anyway, thank you so much for your solution :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900