I have a grid that is bound to data objects. When I look at the grid during an event handler for a button the SelectedItem property is null even though I have selected one in the grid. According to the documentation this should be filled out with the row that is selected. I saw an earlier post that said I needed to use the CurrentRecord property. Is this still the case? This seems like a convoluted way to get to the data that is in the selected row. I am not using AutoGenerate columns but I don't see where that should make any difference.
Below is the XAML for the grid and a code snippet.
This always displays the message box.
We are using the latest (2009 Q3) release.
Don Miller
Below is the XAML for the grid and a code snippet.
<telerikGridView:RadGridView x:Name="grdSwimLanes" Grid.Row="2" AutoGenerateColumns="False" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserFreezeColumns="False" CanUserInsertRows="False" IsFilteringAllowed="False" ShowGroupPanel="False" RowLoaded="grdSwimLanes_RowLoaded" SelectionMode="Single" RowIndicatorVisibility="Collapsed" > |
<telerikGridView:RadGridView.Columns> |
<telerikGridView:GridViewDataColumn DataMemberBinding="{Binding Description, Mode=TwoWay}" Header="Description"/> |
</telerikGridView:RadGridView.Columns> |
</telerikGridView:RadGridView> |
This always displays the message box.
private void RemoveButton_Click(object sender, RoutedEventArgs e) |
{ |
if (grdSwimLanes.SelectedItems.Count < 1) |
{ |
MessageBox.Show("Please select a SwimLane first."); |
return; |
} |
SwimLaneDefinition sld = (SwimLaneDefinition) grdSwimLanes.SelectedItem; |
Lanes.Remove(sld); |
grdSwimLanes.Rebind(); |
} |
We are using the latest (2009 Q3) release.
Don Miller