MVVM – model to data conversion – service layer vs view model
In our Winui3 application, we are following MVVM architecture. I have InvoiceData
, InvoiceModel
, InvoiceViewModel
and InvoiceService
for my Invoice
module.
MVVM – Model to Data conversion – Service Layer vs ViewModel
In our Winui3 application, we are following MVVM architecture. I have InvoiceData, InvoiceModel, InvoiceViewModel and InvoiceService for my Invoice module. During Saving an Invoice from the ViewModel, I need to convert the InvoiceModel to InvoiceData to hit the API. Converting the Model to Data depends on a few other properties in the ViewModel. Let us say if the IsXFeatureEnabled/IsXFeatureVisible property in ViewModel is true, then I need to copy 5 properties in the Model to Data, else I will ignore it. I Cannot have those feature properties in the Model as it is Meta and needed for UI visibility.
Why does my View still bind successfully to my ViewModel even without explicit DataContext
I’m writing an MVVM application in WinUI3, and I’ve run into behaviour which I don’t understand. Currently my main view hosts a NavigationView
control. This control contains a Frame
control, who’s content property is bound to a property in the ViewModel. When the user clicks on an item in the NavigationView
control, the Content
property of the ViewModel is set to the appropriate child ViewModel, and the Frame references a custom Data Template Selector to decide which view to instantiate as a result of this update:
ContentDialog doesnt apear in PageLoaded WinUI3
I have a customized ContentDialog
as shown below to display a progressbar for I/O bounded tasks in WinUI3
: