Programatically bringing a telerik radgridview into view and make the first cell editable

2 posts, 0 answers
  1. Sabuj
    Sabuj avatar
    8 posts
    Member since:
    Jan 2012

    Posted 12 Apr 2012 Link to this post

    I would like to bring a row of my RadGridView into view programatically. I have a more than 100 rows. When I create a row(which I am doing by adding an item to a observable collection) I would like that new row to be selected and bring that into view. I was able to select the new row in my code but could not do the scrolling. More over I want the first cell of the row to be in edit mode so that the user can input text. I am following MVVM pattern for the application and would like to keep zero code in my views. How Can I achieve this?

    Any help or suggestion will be appreciated....

    Here is some of my code

    XAML

    <telerik:RadGridView ItemsSource="{Binding AllPartClasses}" 
                         
    SelectedItem="{Binding SelectedPartClassViewModel, Mode=TwoWay}"        
                         
    SelectionMode="Single" IsSynchronizedWithCurrentItem="True">

    in my view model I did this

    void AddNewPartClassExecute()
        {
            PartClass newPartClass = new PartClass();
            PartClassViewModel tempPartClass = new PartClassViewModel(newPartClass);
            tempPartClass.IsInValid = true;
            AllPartClasses.Add(tempPartClass);
            SelectedPartClassViewModel = tempPartClass;
            Global.DbContext.PartClasses.AddObject(newPartClass);

            //OnPropertyChanged("AllPartClasses");
        }
    public PartClassViewModel SelectedPartClassViewModel
        {
            get
            {  
                return _selectedPartClassViewModel;
            }
            set
            {
                _selectedPartClassViewModel = value;
                OnPropertyChanged("SelectedPartClassViewModel");
            }
        }

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 16 Apr 2012 Link to this post

    Hello,

     Please take a look at this forum thread on how to scroll to the newly added row. Then to put the first cell into edit mode, you will need to call the BeginEdit() method of the GridViewRow.

    Regards,
    Didie
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top