SelectionMode="Single"
SelectionUnit="FullRow"
I select the grid row ( on the row column bar on the left ) and the row highlights and I press Cntl C
I then click for a new row
I then select the NEW grid row ( on the row column bar on the left ) and the NEW row highlights and I press Cntl V
But nothing gets pasted ?
At the moment I only want to cut/paste within the same grid, but evemtually I will need ..
1) Cut/Past to from Excel.and the same grid.
2) A right mouse context menu ( which I have ) but don't know how to make is cut/paste
Guidance please ...
Thanks
Jim
5 Answers, 1 is accepted
Generally, there should be problem to perform the actions you require. I have tested the case on this demo. Once I select an item, copy it (with Cntr + C), select another item and pasted the copied values (Cntr + P), the newly selected item is updated with those copied values.
May you take a look at the example and let me know whether you can get the same behavior there ?
Maya
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
After your reply I implemented a very simple grid and yes Cntrl C and Cntrl V do copy/paste rows.
So I then set about adding bits from my grid to the simple grid till it didn't work.
After some time I discovered it was having INotifyPropertyChanged on the Data class
Suggestions please ( See code below )
<telerik:RadGridView Name="RadGridView1"
ItemsSource="{Binding}"> </telerik:RadGridView>Dim p As ObservableCollection(Of Person)
p = New ObservableCollection(Of Person) p.Add(New Person("Jimmy", "57")) p.Add(New Person("Alan", "28")) p.Add(New Person("Fred", "101")) DataContext = pThis works OK
Public Class Person Public Property name As String Public Property age As String Public Sub New(n As String, a As String) name = n age = a End Sub End ClassThis does not work ?
Public Class Person Implements INotifyPropertyChanged Public Event PropertyChanged As PropertyChangedEventHandler _ Implements INotifyPropertyChanged.PropertyChanged Private Sub NotifyPropertyChanged(ByVal info As String) RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(info)) End Sub Public Property name As String Public Property age As String Public Sub New(n As String, a As String) name = n age = a End Sub End ClassWhen I paste into a new row ( or existing row ) it "apparantly" doesn't work.
However the data is in the row and if I click a cell that cells data appears.
Also if I save the grid and reload ithe new row appears.
So its somthing to do with updating the view I think ???
Any ideas
Jim
You need to raise the PropertyChanged event on the Person class every time you set a property. When pasting, RadGridView checks if the data item implements INotifyPropertyChanged. If it doesn't, it refreshes its view manually. However, there is a small performance penalty when doing this, so if the data item does implement INotifyPropertyChanged, RadGridView relies on the data item to raise the PropertyChanged event and trigger the built-in Silverlight binding update.
In your case, your Person class implements INotifyPropertyChanged, but does not raise PropertyChanged when its properties are set. If you modify the properties to raise the event when they are set, RadGridView should update the UI normally on pasting.
Regards, Yavor Georgiev
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
The grid still seems to update the collection.
Thanks
Jim