Bug, or works as designed? SelectColumn issue...

2 posts, 0 answers
  1. Todd Davis
    Todd Davis avatar
    36 posts
    Member since:
    Aug 2009

    Posted 17 May 2010 Link to this post

    Consider the code below. When you run it, it displays a GridView of colors, with a select column. In this demo, the SelectColumn doesn't "do anything", but let's assume that it will later. Run the demo, and click the CheckBox next to the first item, which is Red. Now, click the Delete button. The row that Red is in goes away, as it should. However, the CheckBox remains, and now Orange is selected.

    Orange is not the row I selected however. When Red row was deleted, I expected the Selected CheckBox to go away with it?

    <UserControl x:Class="TestGridSelection.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
        <Grid x:Name="LayoutRoot"
            <StackPanel Orientation="Vertical"
                <telerikGrid:RadGridView x:Name="radGridView" AutoGenerateColumns="True" SelectionMode="Extended"
                        <telerikGrid:GridViewSelectColumn /> 
                <Button Content="Delete First Item" Click="Button_Click" /> 

    using System.Collections.ObjectModel; 
    using System.Windows; 
    using System.Windows.Controls; 
    namespace TestGridSelection 
        public partial class MainPage : UserControl 
            private ObservableCollection<string> _colors; 
            public MainPage() 
                Loaded += MainPage_Loaded; 
            private void MainPage_Loaded(object sender, RoutedEventArgs e) 
                _colors = new ObservableCollection<string> {"Red""Orange""Blue""Green""Yellow"}; 
                radGridView.ItemsSource = _colors; 
            private void Button_Click(object sender, RoutedEventArgs e) 
  2. Milan
    Milan avatar
    1989 posts

    Posted 19 May 2010 Link to this post

    Hi Todd Davis,

    This behavior is observed because RadGridView is synchronizing its CurrentItem with its SelectedItem. When you delete the first row the next available row is designated as current and automatically this new current item is set as selected. 

    Setting IsSynchronizedWithCurrentItem to false will resolve the problem.

    Sincerely yours,
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top