viewmodel

WinRT ViewModel DataBind to async method

六月ゝ 毕业季﹏ 提交于 2019-12-11 03:14:47
问题 I am deserializing a list of objects from an XML file, and would like to bind to the actual content of those objects in my View, passing over a ViewModel. The problem is that file operations are async and this bubbles all the way up to the ViewModel, where Property getters cannot be marked as such... Problem I deserialize all XML files in a folder to Profile objects and store them in a List<Profile> . This method (has to be) marked async . public static async Task<List<Profile>>

Model binding postback data to a controller action parameter of type List<T>

荒凉一梦 提交于 2019-12-11 03:09:58
问题 I have a strong type view of type List<List<MyViewModelClass>> The outer list will always have two lists of List<MyViewModelClass> . For each of the two outer lists I want to display a group of checkboxes. Each set can have an arbitrary number of choices. My view model class looks similar to this: public class MyViewModelClass { public Area Area { get; set; } public bool IsGeneric { get; set; } public string Code { get; set; } public bool IsChecked { get; set; } } So the final view will look

DataContext values in view code behind

我的未来我决定 提交于 2019-12-11 03:09:20
问题 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 in the view to bind to an endless ticker with a linked list. i.e. private LinkedList<Border> tickerForex = new LinkedList<Border>(); public ForexBuy() { InitializeComponent(); DataContext = new ForexViewModel(); } private void InitializeForexTicker() { CanvasForexBuyTicker.Children.Clear(); foreach

Cannot create an instance of class - ViewModel

回眸只為那壹抹淺笑 提交于 2019-12-11 02:35:23
问题 I'm following an example of google, the example is in java but when I rewrite it in kotlin I can not instantiate the class. I am learning viewmodel. I have a lot of doubt if I messed up the syntax of my kotlin code. https://github.com/googlecodelabs/android-room-with-a-view class MainActivity: AppCompatActivity() { // private lateinit var mWordViewModel: WordViewModel //not works private var mWordViewModel: WordViewModel? = null //not works private var wordListAdapter: WordListAdapter?= null

Can I use ViewModel to send data to the server?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 01:09:44
问题 Currently, I am using ViewModel to load a list of Shows in my app. Then, I display it in the main screen. It survives to configuration changes and does not provoke memory leaks since ViewModel has this features. Now I need to do something a bit different. I need to log in a user making a network call to an endpoint using retrofit 2 and rxjava 2, he will type the email and password, and then will be redirected to the MainActivity. Second, I also need to update the user information, he types

Make child window always on top of all windows

淺唱寂寞╮ 提交于 2019-12-11 00:39:54
问题 I'm writing in wpf. In my viewModel I have a command that opens new window. However sometimes this child window is placed under the parent window. (if for instance I work in my application, then open browser and want to return to my application). Window is opened as follows: MyViewModel vm = new MyViewModel(oper); Mywindow window = new MyWindow(); //Initialize viewModel and set window.DataContext to this viewModel CWPFWindowWithViewModelHelper<IWindowWithViewModel>.InitializeViewModel(window,

Caliburn.micro - notifying a viewmodel on property change in another viewmodel

大城市里の小女人 提交于 2019-12-10 23:57:03
问题 I have a program that connects to a server and sends commands to it. in my program I have 2 windows, one of them is a toolbar with a textbox that shows current status (we'll call that "mainviewmodel") and the other is a login window which receives username and password and logs me into the server (we'll call that "loginviewmodel") now, in order for the mainviewmodel to know the loginviewmodel I use this: [Import] Private LoginViewModel loginViewModel; lunch the login window from the

WPF MVVM call ViewModel Save method on Window Close

时光怂恿深爱的人放手 提交于 2019-12-10 23:25:07
问题 I have figured out how to close Window from my ViewModel. Now I need to solve window close problem from the other side. I need to trigger Save() method in my ViewModel when the user clicks window's close button. I was thinking about binding Command property to Window's close event, but my ViewModel is related to the user control and in that case Close command will not be executed. I was looking at this question as well Disposing WPF User Controls , but I'm afraid that putting Save method call

Observe every item in RACSequence

纵饮孤独 提交于 2019-12-10 22:16:12
问题 I have a method on ParentViewModel which returns an RACSequence of ViewModel objects like so: - (RACSequence *) viewModels { return [self.models.rac_sequence map:^id(Model *model) { return [[ViewModel alloc] initWithModel: model]; }]; } Each of the ViewModels has a state property on which is an enum and has 3 states: NotStarted, InProgress and Completed. When all the ViewModels in my sequence have the state Completed I know ParentViewModel is valid. I have a validSignal on the ParentViewModel

Struggling with SelectList in ASP.NET MVC 2

混江龙づ霸主 提交于 2019-12-10 21:43:41
问题 I have a model that looks something like this: public class SampleModel { public static SampleModel Create() { return new SampleModel { Boolean = true, // set several more properties... Colors = new SelectList(new[] { "Red", "Green", "Blue" }, "Green") }; } public bool Boolean { get; set; } // define several more properties... public SelectList Colors { get; set; } } I'm letting ASP.NET MVC automatically scaffold the properties using Html.DisplayForModel() for my Details view and Html