logo
down
shadow

Passing value from one viewmodel to sub viewmodel


Passing value from one viewmodel to sub viewmodel

By : user2955994
Date : November 22 2020, 10:48 AM
I wish this help you As mentioned, your view's View Model should instance each of the child view models and hold references to them as properties. Then your Tab's data context can be assigned to the view model property in the main windows view model.
This lets your parent view model register for change notification's in your child view models and gives you more control over how they interact.
code :


Share : facebook icon twitter icon
Best way to handle ViewModel passing ViewModel from Controller to View

Best way to handle ViewModel passing ViewModel from Controller to View


By : user3343005
Date : March 29 2020, 07:55 AM
hope this fix your issue probably the format you are rendering the view is not compliant to the default binder:
http://www.hanselman.com/blog/ASPNETWireFormatForModelBindingToArraysListsCollectionsDictionaries.aspx
methodAccessException when passing variables from ViewModel to ViewModel on WP7 using anonymous object (MVVMCross)

methodAccessException when passing variables from ViewModel to ViewModel on WP7 using anonymous object (MVVMCross)


By : Aarya Patil
Date : March 29 2020, 07:55 AM
it helps some times The anonymous class will most definitely be created as internal by the compiler - which is why you need the line [assembly: InternalsVisibleTo("Cirrious.MvvmCross.WindowsPhone")]
Can you check that the AssemblyInfo.cs file definitely being linked into the project (and that this is the project containing the ViewModel/anonymous-class code)?
MVVM ViewModel Passing Parameters to another ViewModel

MVVM ViewModel Passing Parameters to another ViewModel


By : dada santos
Date : March 29 2020, 07:55 AM
Any of those help Create a ViewModel assign a the salesman to a property of the viewmodel. Then give your View the Viewmodel instead.
Or if you are using dependency injection, you could create your ViewModel, have an interface to the view get injected into the constructor, set ViewModel.SalesPerson = person, and call ViewModel.Present() which calls IView.ShowDialog().
MvvmCross passing data from One viewmodel to another viewmodel

MvvmCross passing data from One viewmodel to another viewmodel


By : Romulo Silva
Date : March 29 2020, 07:55 AM
like below fixes the issue Look into the MvvmCross Messenger to do this: https://github.com/MvvmCross/MvvmCross-Plugins/tree/master/Messenger
You need to subscribe for something on your viewmodel:
code :
public class LocationViewModel 
: MvxViewModel
{
private readonly MvxSubscriptionToken _token;

public LocationViewModel(IMvxMessenger messenger)
{
    _token = messenger.Subscribe<LocationMessage>(OnLocationMessage);
}

private void OnLocationMessage(LocationMessage locationMessage)
{
    Lat = locationMessage.Lat;
    Lng = locationMessage.Lng;
}

// remainder of ViewModel
}
knockout.js remove doesn't work with nested viewmodel and viewmodel in main viewmodel

knockout.js remove doesn't work with nested viewmodel and viewmodel in main viewmodel


By : Sivaram Siddhan Ilan
Date : March 29 2020, 07:55 AM
this will help Use $parents[index] to get to specific parent. http://knockoutjs.com/documentation/binding-context.html.
$parents[0] --> parent
code :
var initialData = [
  { basename: "Danny", subItems: [
  { subitemname: "Mobile"},
  { subitemname: "Home"}]
},
{ basename: "Sensei", subItems: [
  { subitemname: "Mobile"},
  { subitemname: "Home"}]
}];

var SimpleListModel2 = function(baselist) {
  var self= this;
  self.baselist= ko.observableArray(baselist);
  self.addChild = function(list) {
    alert(list.basename);
  }.bind(this);

  self.removecard = function (data) {
    //tried
    console.log(data);
  };
};

var masterVM = (function () {
     var self = this;      
     self.SimpleListModel2= new SimpleListModel2(initialData);
})();

ko.applyBindings(masterVM);  
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js"></script>

<div data-bind="with: SimpleListModel2">  
  <div data-bind="foreach: baselist">
    <div>
      <span data-bind="text: basename"></span>
      <div data-bind="foreach: subItems">
        <span data-bind="text: subitemname"></span>
        <a href="#" data-bind="click: $parents[1].removecard">Del</a>
      </div>     
    </div>
    <button data-bind="click:$parent.addChild">Add</button>
  </div>
</div>
Related Posts Related Posts :
  • I am trying to do a while loop with a string conditional statement in C#
  • C# 'Cannot access a disposed object. Object name: 'SslStream'.'
  • How to make Gecko use seperate CookieContainer per instance?
  • C# Advanced form "please wait"
  • Send and Receive data C# using network stream
  • How to discover that appsettings changed in C#?
  • Check what needs full trust
  • What is the execution order of an MVC Razor view/layout
  • Table designer (Entity Framework) is too resource intense
  • How to clean up an exception string so it can be displayed via Javascript Alert?
  • Configuring Amazon SES Feedback Notifications via Amazon SNS in ASP.NET MVC (C#)
  • C# api responce and request
  • Dynamodb putitem function not working properly
  • theme in windows phone(light or dark) using c#
  • Backup attached database file(.mdf) using c# and SQL Server
  • What is 'TextFile' and where it is uses in WPF project
  • Using same alias for multiple namespaces
  • how to move mails into separate folders
  • Multithreaded Uploader
  • Memory fragmentation?
  • C# correct exception handling
  • "Could not open macro storage" when accessing using file on another machine
  • How to access other directories of hosted server
  • C# Jagged Array check if value exists/true
  • Why can't I type Clone() properly?
  • exception on accessing dictionary from list
  • Getting the immediate response from server without waiting to 200 message
  • Why am I getting exception Directory Is Not empty?
  • Could not load file or assembly 'CefSharp.dll' or one of its dependencies
  • Sending Email By Using C# in unity3D?
  • Correct usage of await async in webapi
  • Program update code issue
  • Marshal.Copy attempted to read or write protected memory At Random Times
  • Restrict Type variable to specific class or subclass
  • Horizontal text alignment in a PdfPCell
  • C# crashing with Form.show() command, ObjectDisposedException - Deeper look / explanation please
  • Will the result of a LINQ query always be guaranteed to be in the correct order?
  • "Could not find default endpoint element that references contract"
  • Umbraco Request.QueryString is null if it's the first time the page is loaded
  • Error inconsistent accessibility method C#
  • How to program Intel Xeon Phi with C#?
  • remove nested element using regular expression
  • Is there a C# alternative to Java's vararg parameters?
  • Clear particular column values in DataTable
  • how to add event handler to programatically created checkboxes
  • Cannot apply indexing with [] to an expression of type 'System.Collections.Specialized.NameValueCollection'
  • Check for key in pre-existing dictionary in case insensitive manner
  • How to remove year from datetime object?
  • Accessing Settings in different ways
  • "This project is empty" error in Sonarqube
  • How to create reusable icon menu in Xamarin
  • Value Cannot be null in Ado.Net connectivity
  • Adding a custom/dynamic attribute when using XSD.exe
  • How to convert object to correct type
  • Automatically sign out from Forms Authentication in ASP.NET when browser is closed
  • Can a WCF service support both Buffered and Streamed transfer modes?
  • Verify a CA Certificate with a public key in C#
  • How to invoke a Web Service that requires the "patch" verb using the C# WebClient wrapper?
  • Proper way a implementing property based on generic type
  • Closing a form that is created in another thread
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org