Managing events generated by controls placed on the smartpart(view)

Topics: CAB & Smart Client Software Factory
Jan 11, 2007 at 12:12 PM
Hi all

I want to know if for instance i have a smart part and i placed a grid control on it. Then if user has the facility to add/edit . Then how i can manage these events in the smartpart.cs file. One is a classic way of registering event and handling in smaprtpart.cs file. But how can i use the MVP design patteren in this regard to isolate the smart part and presenter w.r.t. business logic.


Jan 11, 2007 at 2:39 PM
The M-V-P patterns differs from the Classic M-V-C in the sense that all use gestures are handled by the UI (View) and then delegated to the presenter. Here is an example:

public void btnEdit_Click(object sender, EventArgs e)
Jan 12, 2007 at 6:38 AM
ahan . Thanks ! i am agree with this approach . But i want to know if there is some logic that is related to grid rows. For instance if user click on a cell and i have to attach a combo box with it and even more hiding and displaying some columns based on user action , or even creating of new columns and rows based on user selection . In all these cases respective logic should either be on smart part.cs file, or can i allow the presenter to be aware of the grid control on the view and make all the above requirement handled in the presenter( It looks some what overhead) but i am eager to know that what is recommended way.


Jan 12, 2007 at 7:44 PM
Well, if I understand what you're saying, I think I am doing something similar with a ListView. I populate the listview in my view, and I have the listView_DoubleClick event in the view, but my logic in handling what I do next goes into the Presenter, which I call from the DoubleClick event.