This is a migrated thread and some comments may be shown as answers.

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

1 Answer 60 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sabuj
Top achievements
Rank 1
Sabuj asked on 12 Apr 2012, 09:25 PM

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");
        }
    }

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 16 Apr 2012, 09:43 AM
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 >>

Tags
General Discussions
Asked by
Sabuj
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or