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

Porting from DevExpress to Telerik

3 Answers 173 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
New
Top achievements
Rank 1
New asked on 17 Jan 2013, 04:56 PM
Dear Telerik,

I have a license for both DevExpress and Telerik (license check required?). Currently, I would like to port a DevExpress DataGrid (WinForm) to Telerik RadGridView (WPF). The .NET framework I am using is 3.5 and I am not allowed to upgrade it to 4.5, unfortunately, so I am stuck with an older version of Telerik.

Since I am still in the process of working up a solution, the list of problems I have may change (increase) over time, but so far these are the two main issues I've encountered so far:

1. Row selection

I cannot get RadGridView to return the row indices of the selected rows. It appears later version has a SelectedRows property but my version only has SelectedCells and SelectedItems. The cell info objects, interestingly, only has information on column and not row.

2. Multithreading

The DevExpress DataGrid I am porting appears to have code that involve multithreading handling. I did a brief Google search and the way to port things like "InvokeRequired" did not seem immediately obvious. Is there like a FAQ for this topic?

Thanks for now.

3 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 21 Jan 2013, 12:27 PM
Hello,

1. Row selection: It is not recommended to work with visual elements in a virtualized control (no matter if it is RadGridView, DataGrid, etc.). The thing is that each element is recycled and reused on scrolling.
What you should do in this case is to work with SelectedItems collection of the grid.

2. Multithreading: We do not provide such in RadGridView. I'm afraid that it's up to you to implement your business logic in such a way that it executes on a separate thread, but fires all the necessary notifications on the UI thread.


Kind regards,
Hristo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
New
Top achievements
Rank 1
answered on 21 Jan 2013, 08:28 PM
Thanks for the reply.

1. I will check again to see if I can easily get the Row from SelectedItems

2. Okay

There's another couple of question that popped up:

3. I am using DataTable as an ItemsSource. Currently, I am handling my validation at the Data layer by adding an OnRowChanging() hander to the DataTable which, upon failed validation, rejects the changes. However, what I have trouble is with funneling the error messages to the RadGridView so that it gets displayed. Is there a standard way of doing things like this?

4. As noted in #3, I am using DataTable as the ItemsSource. Currently, I have a refresh button control that will resynch the DataTable with some other data source. In this case, the DataTable appears to synch properly with that data source but it appears to have trouble synching with the RadGridView.

When the DataTable is initialized and updated using this following code:

---------------------------------------------------------------------------
//// dt is my DataTable ////
dt.Reset();
dt.BeginInit();  // Do I even need this?

dt.TableName = model.Table.Table.Name;
/////// add Columns
dt.BeginLoadData(); // Do I even need this?
/////// Add rows
dt.EndLoadData();
dt.EndInit();
dt.AcceptChanges();
radgridview.ItemsSource = null;
radgridview.ItemsSource = dt.DefaultView;
---------------------------------------------------------------------------

When DataTable is initiated, it's fine. But when I click refresh and this is run again, all the rows disappear. The columns are updated fine but the rows are not. And I can tell from the debugger that the rows are actually added to the DataTable. What's interesting is that when I insert a row, it also instantly disappears even though it is actually added to DataTable properly. 

Now let's say, I remove the dt.Reset() operation and, instead, do dt.Columns.Clear() and dt.Clear(), then I get another issue - where the columns now do not update properly but the rows are showing fine.
0
New
Top achievements
Rank 1
answered on 22 Jan 2013, 03:17 PM
On #4, it appears that changing from dt.Reset() to dt.Columns.Clear() and dt.Rows.Clear() fixes the issue. However, using dt.Clear() does not. The solution does not seem very intuitive considering how all 3 approaches should work by definition.
Tags
General Discussions
Asked by
New
Top achievements
Rank 1
Answers by
Hristo
Telerik team
New
Top achievements
Rank 1
Share this question
or