Skip to main content
5 events
when toggle format what by license comment
Aug 26, 2023 at 19:49 comment added Ewan While i sympathise with your live preview issue, I cant help but think its a symptom of the patterns you are using rather than a legitimate problem
Aug 26, 2023 at 19:47 comment added Ewan just map the combo box to models?
Aug 26, 2023 at 19:27 comment added aelsi2 I can also think of a much less complicated example that demonstrates a similar problem to the one in the title of the question. Suppose, we have a view model with a list of view models where each one corresponds to some model and we have a ComboBox's ItemsSource bound to this list. Then we have a property for a single item that we bind ComboBox's SelectedItem to. How do we get the model from the selected item (which is a view model) without exposing it model to the view?
Aug 26, 2023 at 19:22 comment added aelsi2 While I agree that my design suffers from duplication of concerns and I should get rid of the interfaces in the model layer, I really can't get rid of the view models for each individual model and interfaces for view models because at the same time while editing the properties there is a "live preview" observing these view models. It observes the view models directly, without binding, subscribing to INotifyPropertyChanged and reading their properties (it's not under my control) so the best thing I can do to decouple them is to introduce interfaces.
Aug 26, 2023 at 16:52 history answered Ewan CC BY-SA 4.0