I’m coming from a winforms background and trying to get ahold of MVVM and XAML. Right now I’m wondering how I can take advantage from a data-shaping control (either native or provided by a third party) while maintaining separation of concerns intact.
An example: I have a typical third party grid that comes with data grouping, sorting and filtering functionalities. I want the end user to be able to use these features so that he can get a custom set of data on which he can perform actions. These actions are exposed by the view model. Of course it knows about the record collection but it has absolutely no clue about how it is currently displayed in the UI.
Given that, how can the view model know on which data actions should be performed, without knowing about the control in which it is displayed?
Right now the only way I can think of is exposing an additional property in the ViewModel (something like CurrentUIData
) and handling every single data-shaping events within the View so that the property is always representative of the UI state. This, however, feels kind of wrong to me.
Is this how I should proceed, or am I missing something here?
9