I have a BindableLayout with a list of objects that contain Command's and methods that dictate what to do when the user completes actions within the specific item. Because this is, technically, no longer a model but a container, with the model and varying functions inside, it almost acts as a ViewModel. But then this means each item inside the BindableLayout is technically a ViewModel. Is it common practice to have the business logic inside of each item?
I've tried to find other ways of getting the method callouts I need outside the container model but there is no other way and I can't find anybody online talking about this practice specifically. Hoping someone here can help. I'm looking for a "No, don't do that because ......" or a "Yes, it is okay to do that because of ...."
The Container Code
public class ThoughtEntryContainer : INotifyPropertyChanged
{
public ICommand SetNTHeightCommand { get; }
public ICommand SetDTHeightCommand { get; }
public ICommand SetCTHeightCommand { get; }
public ICommand OpenDistortionSelectorCommand { get; }
private int thoughtNumber;
private double ntHeight;
private double dtHeight;
private double ctHeight;
private double maxHeight;
ThoughtEntry thoughtEntryData; // This is the model itself
string distortionLabel;
public ThoughtEntryContainer()
{
MaxHeight = -1; // Set to -1 to set Height Request to Auto
SetNTHeightCommand = new Command<StackLayout>(SetNTHeight);
SetDTHeightCommand = new Command<StackLayout>(SetDTHeight);
SetCTHeightCommand = new Command<StackLayout>(SetCTHeight);
OpenDistortionSelectorCommand = new Command<List<Distortion>>(OpenDistortionSelectorPopUp);
SetDistortionLabelText();
}
// Extra Code containing commands below here. Removed to save space. Not needed as concept is shown and explained in post
// ....
}