3 Answers, 1 is accepted
0
Hi Enric,
If you want your application to focus on the first row after loading you can set the property IsSynchronizedWithCurrentItem to true.
However, if you want to set the focus to row different than the first one, you should do it by setting the SelectedItem property during Loaded event. For example if you want to set it to the third row, the expression will be:
You should also set the RadGridView property EnableLostFocusSelectedState to False if you don't want to show the the unfocused state. This is explained in more details here: link.
Regards,
Hristo
Telerik
If you want your application to focus on the first row after loading you can set the property IsSynchronizedWithCurrentItem to true.
However, if you want to set the focus to row different than the first one, you should do it by setting the SelectedItem property during Loaded event. For example if you want to set it to the third row, the expression will be:
private
void
RadGridView_Loaded(
object
sender, RoutedEventArgs e)
{
this
.RadGridView.SelectedItem =
this
.RadGridView.Items[2];
}
You should also set the RadGridView property EnableLostFocusSelectedState to False if you don't want to show the the unfocused state. This is explained in more details here: link.
Regards,
Hristo
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0

Enric
Top achievements
Rank 1
answered on 13 Jan 2014, 10:28 PM
Hi Hristo, It did the trick. It does works.
But my goal is a little bit beyond of your solution. At first I would like to search that row before to select it
Public valuefrom as integer
Public Sub New(IdPlate as integer)
valuefrom = IdPlate
End Sub
Private Sub dgvOrdenes_Loaded(sender As Object, e As RoutedEventArgs)
??
how can I retrieve the value provided in "valuefrom" variable without using SQL or LINQ some value in my RadGridView??
Me.dgvOrdenes.SelectedItem = dgvOrdenes.Items(?????)
End Sub
I've tried use this snippet but does not works because Rows method is not available at all:
Thanks in advance
But my goal is a little bit beyond of your solution. At first I would like to search that row before to select it
Public valuefrom as integer
Public Sub New(IdPlate as integer)
valuefrom = IdPlate
End Sub
Private Sub dgvOrdenes_Loaded(sender As Object, e As RoutedEventArgs)
??
how can I retrieve the value provided in "valuefrom" variable without using SQL or LINQ some value in my RadGridView??
Me.dgvOrdenes.SelectedItem = dgvOrdenes.Items(?????)
End Sub
I've tried use this snippet but does not works because Rows method is not available at all:
Dim lastRow As GridViewRowInfo = RadGridView1.Rows(RadGridView1.Rows.Count - 1) lastRow.IsSelected = True For Each rowInfo As GridViewRowInfo In RadGridView1.Rows If rowInfo.IsSelected Then rowInfo.EnsureVisible() End If Next
Thanks in advance
0
Hello Enric,
Can you provide me with more information? Do you want to search for a row based on some condition, or you want to get all items satisfying the search condition?
Also please note that RadGridView doesn't have property Rows because the row is a visual element. You should use the property Items when you want to get the item located on a particular row. When RadGridView has enabled virtualization, the only existing items are the items located in the viewport.
Regards,
Hristo
Telerik
Can you provide me with more information? Do you want to search for a row based on some condition, or you want to get all items satisfying the search condition?
Also please note that RadGridView doesn't have property Rows because the row is a visual element. You should use the property Items when you want to get the item located on a particular row. When RadGridView has enabled virtualization, the only existing items are the items located in the viewport.
Regards,
Hristo
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>