I've got a recent problem:
My grid looks like this:
Grid shows objects with filled values (in this case object's property is
ExpositionType). Everythig looks fine until grid is scrolled via vertical scrollbar. When row goes out of the visibility range null value is inserted into the object's
ExpositionType property.
I dont use GridViewComboBoxColumn because I want to edit values without switching grid into edit mode (it requires more clicks).
My question is: how to prevent grid from deleting my data when scrolled?
<telerikG:RadGridView x:Name="ExpositionFilterRules"
AutoGenerateColumns="False"
SelectionMode="Single" FontSize="14"
AllowDrop="False" CanUserDeleteRows="False"
CanUserFreezeColumns="False" CanUserInsertRows="False" CanUserReorderColumns="False"
ShowGroupPanel="False" RowIndicatorVisibility="Collapsed"
ScrollMode="Deferred"
AutoExpandGroups="True" SelectionChanged="ExpositionFilterRules_SelectionChanged" IsEnabled="True" IsReadOnly="False">
<telerikG:RadGridView.Columns>
<telerikG:GridViewDataColumn Header="{StaticResource Promotions_ExpositionRule_Name}" DataMemberBinding="{Binding Name}" IsFilterable="False" IsReadOnly="True" MinWidth="150"/>
<telerikG:GridViewDataColumn Header="{StaticResource Promotions_ExpositionRule_ExpositionType}" MinWidth="200">
<telerikG:GridViewDataColumn.CellTemplate>
<DataTemplate>
<telerikG:RadGridView x:Name="ExpositionFilterRules" <ComboBox ItemsSource="{DynamicResource ExpositionTypes}" SelectedItem="{Binding ExpositionType}" SelectionChanged="ComboBox_SelectionChanged"></ComboBox>
</DataTemplate>
</telerikG:GridViewDataColumn.CellTemplate>
</telerikG:GridViewDataColumn>
<telerikG:GridViewDataColumn Name="ItemsCount" Header="{StaticResource Promotions_ExpositionRule_ItemsCount}" DataMemberBinding="{Binding ItemsCount}" IsFilterable="False" IsReadOnly="{Binding ExpositionType.IsTemporary}" Width="120"/>
<telerikG:GridViewDataColumn Name="Duration" Header="{StaticResource Promotions_ExpositionRule_Duration}" DataMemberBinding="{Binding Duration}" IsFilterable="False" Width="120"/>
<telerikG:GridViewDataColumn Name="EstimatedSaleValue" Header="{StaticResource Promotions_ExpositionRule_EstimatedSaleValue}" DataMemberBinding="{Binding EstimatedSaleValue}" IsFilterable="False" Width="120" DataFormatString="{}{0:F2}"/>
</telerikG:RadGridView.Columns>
</telerikG:RadGridView>
<telerikG:RadGridView x:Name="ExpositionFilterRules"
AutoGenerateColumns="False"
SelectionMode="Single" FontSize="14"
AllowDrop="False" CanUserDeleteRows="False"
CanUserFreezeColumns="False" CanUserInsertRows="False" CanUserReorderColumns="False"
ShowGroupPanel="False" RowIndicatorVisibility="Collapsed"
ScrollMode="Deferred"
AutoExpandGroups="True" SelectionChanged="ExpositionFilterRules_SelectionChanged" IsEnabled="True" IsReadOnly="False">
<telerikG:RadGridView.Columns>
<telerikG:GridViewDataColumn Header="{StaticResource Promotions_ExpositionRule_Name}" DataMemberBinding="{Binding Name}" IsFilterable="False" IsReadOnly="True" MinWidth="150"/>
<telerikG:GridViewDataColumn Header="{StaticResource Promotions_ExpositionRule_ExpositionType}" MinWidth="200">
<telerikG:GridViewDataColumn.CellTemplate>
<DataTemplate>
<telerikG:RadGridView x:Name="ExpositionFilterRules"
AutoGenerateColumns="False"
SelectionMode="Single" FontSize="14"
AllowDrop="False" CanUserDeleteRows="False"
CanUserFreezeColumns="False" CanUserInsertRows="False" CanUserReorderColumns="False"
ShowGroupPanel="False" RowIndicatorVisibility="Collapsed"
ScrollMode="Deferred"
AutoExpandGroups="True" SelectionChanged="ExpositionFilterRules_SelectionChanged" IsEnabled="True" IsReadOnly="False">
<telerikG:RadGridView.Columns>
<telerikG:GridViewDataColumn Header="{StaticResource Promotions_ExpositionRule_Name}" DataMemberBinding="{Binding Name}" IsFilterable="False" IsReadOnly="True" MinWidth="150"/>
<telerikG:GridViewDataColumn Header="{StaticResource Promotions_ExpositionRule_ExpositionType}" MinWidth="200">
<telerikG:GridViewDataColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{DynamicResource ExpositionTypes}" SelectedItem="{Binding ExpositionType}" SelectionChanged="ComboBox_SelectionChanged"></ComboBox>
</DataTemplate>
</telerikG:GridViewDataColumn.CellTemplate>
</telerikG:GridViewDataColumn>
<telerikG:GridViewDataColumn Name="ItemsCount" Header="{StaticResource Promotions_ExpositionRule_ItemsCount}" DataMemberBinding="{Binding ItemsCount}" IsFilterable="False" IsReadOnly="{Binding ExpositionType.IsTemporary}" Width="120"/>
<telerikG:GridViewDataColumn Name="Duration" Header="{StaticResource Promotions_ExpositionRule_Duration}" DataMemberBinding="{Binding Duration}" IsFilterable="False" Width="120"/>
<telerikG:GridViewDataColumn Name="EstimatedSaleValue" Header="{StaticResource Promotions_ExpositionRule_EstimatedSaleValue}" DataMemberBinding="{Binding EstimatedSaleValue}" IsFilterable="False" Width="120" DataFormatString="{}{0:F2}"/>
</telerikG:RadGridView.Columns>
</telerikG:RadGridView>
<ComboBox ItemsSource="{DynamicResource ExpositionTypes}" SelectedItem="{Binding ExpositionType}" SelectionChanged="ComboBox_SelectionChanged"></ComboBox>
</DataTemplate>
</telerikG:GridViewDataColumn.CellTemplate>
</telerikG:GridViewDataColumn>
<telerikG:GridViewDataColumn Name="ItemsCount" Header="{StaticResource Promotions_ExpositionRule_ItemsCount}" DataMemberBinding="{Binding ItemsCount}" IsFilterable="False" IsReadOnly="{Binding ExpositionType.IsTemporary}" Width="120"/>
<telerikG:GridViewDataColumn Name="Duration" Header="{StaticResource Promotions_ExpositionRule_Duration}" DataMemberBinding="{Binding Duration}" IsFilterable="False" Width="120"/>
<telerikG:GridViewDataColumn Name="EstimatedSaleValue" Header="{StaticResource Promotions_ExpositionRule_EstimatedSaleValue}" DataMemberBinding="{Binding EstimatedSaleValue}" IsFilterable="False" Width="120" DataFormatString="{}{0:F2}"/>
</telerikG:RadGridView.Columns>