This is a migrated thread and some comments may be shown as answers.
New data bound row registered through DI source
2 Answers 9 Views
This is a migrated thread and some comments may be shown as answers.
Travis
Top achievements
Rank 1
Travis asked on 03 May 2013, 07:45 PM
Hello,

I am learning how to wire up a new row with my backing data source list. In and of itself, straightforward enough, the objects constituting the backing list need to have a parameterless constructor. Simple enough.

Now for the twist. I have an architecture in the view that wires up some bbv EventBroker events, which ordinarily (ideally, preferred) wire up through a Ninject Dependency Injection Kernel OnActivation, I register some pub/sub events to route communication between objects behind the scenes.

So... Is it possible for me to wire up the RadGridView object-factory (object-provider? -context?) in such a way that I can factory-create the object(s) backing the row(s) being created?

Thank you once again for the rich UX API, and thank you...

Regards,

Michael Powell

2 Answers, 1 is accepted

Sort by
0
Travis
Top achievements
Rank 1
answered on 03 May 2013, 08:29 PM
Possibly related, corollary to this one: the events are working through the EventBroker as far as they shake out. By that I mean, the data model backing the RadGridView is receiving the correct updates. However, attempts to refresh or invalidate the grid are not working.

Here's the scenario: I am using a Checkbox (bool) property bound to a model view (wrapper to the model). This appears in the grid and I can edit okay. I want it to be a one-row-at-a-time-checked operation. When I check one, the others should uncheck, and so on. If I uncheck one, no-op on the others (effectively).

As I said the model backing the grid is itself working. However, the grid is not receiving the updates. I have verified that I am issuing a PropertyChanged event for the model. This is consistent throughout the model and model view.

Any ideas? Do I need to force each row to subsequently invalidate?

*Edit*: Okay, so through some EventBroker wizardry, I have the view containing the RadGridView also listening for the selected event, and subsequently coordinating GridViewRowInfo.InvalidateRow() for DataBoundItems matching the thing being viewed.
0
Peter
Telerik team
answered on 08 May 2013, 01:08 PM
Hi Michael,

It seems that your application is quite complex and you are using many technologies in it and I am not sure that I understand your scenario precisely.

However, RadGridView should update automatically when the underlying source is updated (considering the objects are in an IBindingList collection and they implement the INotifyPropertyChanged interface). If this does not happen in your scenario I could suggest to update the grid manually in the OnPropertyChanged event using MasterTemplete's Refresh method:
this.radGridView1.MasterTemplate.Refresh();
and vice versa you can update the underlying source using the grid's CellValueChanged event and push the changed values back to the database.

I really hope that this is applicable for your application.

Greetings,
Peter
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Asked by
Travis
Top achievements
Rank 1
Answers by
Travis
Top achievements
Rank 1
Peter
Telerik team
Share this question
or