Let's say I want to implement Passive View design pattern. I have a view which contains a listbox (which I perhaps will swap with listview or something else in the future). Now, with Passive View one should make the view as dumb as possible. Lets say I want to change the selection. I will put the logic for this in the presenter, thus I add a property to the views interface to get and set SelectedIndex property of the view's listbox. But if I in the future want to swap the listbox with a listview I am in trouble, because listview does not have a SelectedIndex property. Do I then implement some logic in the view (essentially making it a little less dumb) something like:
public int SelectedIndex
{
get
{
if (myListView.SelectedIndices.Count > 0)
{
return myListView.SelectedIndices[0];
}
return -1;
}
}
Or do I put some kind of adapter between the view and the presenter. What would be the most logical approach?