viewmodel Questions

2

I have two tabs that is bind to one viewmodel which contain a PlotModel of oxyplot and view model selected through a DataTemplate. When click on the first tab the viewmodel was bind properly but wh...
Intercommunion asked 14/9, 2014 at 13:0

5

Solved

is it possible to bind an itemscontrol with canvas as template to multiple DataTemplates? I have 2 collections and depending on the type I would like to display a different control on my canvas. ...
Barstow asked 29/3, 2011 at 13:8

5

Solved

I'm learning Jetpack Compose and I was trying to make a View Model for my @Composable. In documentation (https://developer.android.com/codelabs/jetpack-compose-state#3) for observing state changes ...
Chook asked 10/3, 2021 at 7:48

10

Solved

I'm trying to implement viewmodel with kotlin. First I added the needed dependecies: implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.core:core-ktx:1.2.0' // ViewModel ...
Rebroadcast asked 24/3, 2020 at 11:32

3

Solved

IN an MVVM pattern is it acceptable or even possible to access ViewModel properties in the views code behind? I have an observable collection which is populated in the ViewModel. I need to use it ...
Jarietta asked 6/12, 2012 at 21:48

9

I am trying to test ViewModel to make sure livedata gets updated correctly. However when using ArgumentMatchers.any() it fails with IllegalStateException saying: ArgumentMatchers.any(mViewModel.Co...
Borough asked 7/12, 2019 at 20:45

1

Solved

Trying to integrate Jetpack ViewModel into KMP project. With the following configuration, desktop app cannot be compiled (error bellow). libs.versions.toml androidxLifecycle = "2.8.0" koi...

1

I want to inject View Model in Service , how can it possible. I recently started using DI in my project through Dagger Hilt. I'm having no problems when injecting viewModel instances into Activity/...
Ectoblast asked 21/1, 2022 at 9:47

3

Solved

I have a WPF window and am using the MVVM pattern. I set the view model as a resource for the window as follows... <Window ...other stuff removed for clarity... xmlns:mvvm="clr-namespace:Visi...
Chandler asked 13/4, 2011 at 15:28

3

how we can initialize the viewModel in a service. in a fragment, we do that with Kotlin delegate "by activityViewModels". or we can do it with the ViewModelProvider().get. but as far as I...
Ordonez asked 11/7, 2020 at 11:9

3

Solved

I'm using Jetpack Compose now. I realized I could have ViewModel per my composable and init view model in composable just like this: val myViewModel:MyViewModel = viewModel() But there is a proble...
Affricate asked 28/11, 2021 at 6:33

10

Solved

I'm using Automapper and I have the following scenario: Class OrderModel has a property called 'ProductName' that isn't in the database. So when I try to do the mapping with: Mapper.CreateMap<O...
Annecorinne asked 14/2, 2011 at 0:22

6

Solved

I am seeking clarification on the definitions of the terms Entity, Model, DataModel, and ViewModel within the context of software development. Could someone provide a detailed explanation for...
Laconic asked 5/1, 2012 at 14:20

2

Solved

I would like to share a viewmodel between many composables. Just like how we share a viewmodel between fragments within an Activity. But when I try this setContent { val navController = rememberNa...

1

Solved

The following minimal code toggles the display of details by pressing a button. struct ContentView: View { @State var showDetails: Bool = false var body: some View { VStack { DetailsButton(show...
Desberg asked 17/9, 2023 at 21:43

4

Solved

I am trying to display several download progress bars at once via a list of data objects containing the download ID and the progress value. The values of this list of objects is being updated fine ...

4

Solved

I've got a ViewModel that takes some Model data and slightly alters it. The way I'm doing it "works" since I just pass the DomainModel to the constructor for the ViewModel, but since I'm using Aut...
Ekaterinburg asked 3/2, 2012 at 16:49

3

Solved

Anyone has any clue how to retain a shared view model object across different composables? I'm using hilt and injecting viewmodel instance using hilt in composable. Basically there are 3 screens wh...
Fleeman asked 19/5, 2022 at 11:25

2

Or am I required to use a controller? I have a Movies Class, a Genres Class, and a Media class that I will need to combine in a Model View so that I can have access to multiple models on my Razor P...
Assembly asked 2/5, 2019 at 18:9

2

Solved

I´m trying to figure out the simplest way to test this kind on function members, I´ve seen more complex cases like Coroutines - unit testing viewModelScope.launch methods but didn´t solved ListScr...
Proviso asked 9/4, 2022 at 12:15

11

Solved

Is there a way to pass additional argument to my custom AndroidViewModel constructor except Application context. Example: public class MyViewModel extends AndroidViewModel { private final LiveDat...
Aside asked 18/9, 2017 at 16:17

4

Solved

I have a need to update the user profile switch ViewModel class ProfileViewModel : BaseViewModel() { var greet = mutableStateOf(user.pushSetting.greet) var message = mutableStateOf(user.pushSe...
Diazomethane asked 18/9, 2021 at 1:15

4

I have a problem with Hilt and ViewModel. I'm getting RunTimeException: MainViewModel> has no zero argument constructor I spent hours to find what is wrong... Here are sources from my code: App...
Coretta asked 7/2, 2022 at 18:52

2

With LiveData inside a Viewmodel we use switchMap or Transformations.map like this val recipesList = cuisineType.switchMap { repository.getDisplayRecipes(it.cuisineType).asLiveData() } What would ...
Wittenberg asked 7/2, 2021 at 20:59

3

Example: I have a @Composable func WorkoutScreen(...) which injects a dedicated ViewModel (e.g. with hilt). It displays some different child composables like @Composable func ProgressView(...) and ...
Jerryjerrybuild asked 12/2, 2022 at 18:45

© 2022 - 2024 — McMap. All rights reserved.