Giter Club home page Giter Club logo

Comments (5)

damirarh avatar damirarh commented on August 15, 2024

Imported comment written by Yury Yatskov on 2016-05-13T22:04:45

How do I get an incoming argument when EventName = "Loaded"?

from damirscorner-utterances.

damirarh avatar damirarh commented on August 15, 2024

Imported comment written by Damir Arh on 2016-05-14T09:04:19

The event argument will automatically be sent to your command if its signature allows incoming arguments. E.g.:


public ICommand ActivateCommand { get; } =
new RelayCommand<routedeventargs>(arg =>
{
// args value will be the same as
// the second argument value in the event handler
}

from damirscorner-utterances.

damirarh avatar damirarh commented on August 15, 2024

Imported comment written by Yury Yatskov on 2016-05-16T15:23:06

Thank you!

Input has argument = null.

Required to pass the selected value (class) from one page to another. The value is selected in the ListView on Page1 and is passed as the input parameter Page2.

On Page1 navigation:

AppShell.Current.AppFrame.Navigate (typeof (CashAccountPageElement), SelectedCashAccount);

On Page2:
XAML:
...
xmlns: interactivity = "using: Microsoft.Xaml.Interactivity"
xmlns: core = "using: Microsoft.Xaml.Interactions.Core"
....
<interactivity: interaction.behaviors="">
<core: eventtriggerbehavior="" eventname="Loaded">
<core: invokecommandaction="" command="{Binding Path = LoadedCommand, Mode = OneWay}"/>

</interactivity:interaction.behaviors>

....

CS (ViewModel):

private RelayCommand <routedeventargs> loadedCmd;
public RelayCommand <routedeventargs> LoadedCommand
{
get
{
return this.loadedCmd ?? (This.loadedCmd = new RelayCommand <routedeventargs>

((Rea) =>

{

var result = rea;

}));

}

}

It accepts the argument "rea" of null. (SelectedCashAccount not null)
What do I need to add?

from damirscorner-utterances.

damirarh avatar damirarh commented on August 15, 2024

Imported comment written by Damir Arh on 2016-05-17T21:58:20

Well, the parameter that you are passing to Page2 via Navigate method is not included in RoutedEventArgs of Loaded event.

You will need to read the value by overriding OnNavigatedTo in Page2:


protected override void OnNavigatedTo(NavigationEventArgs e)
{
var parameter = e.Parameter;
}

You can pass this value to the view model directly from within this method by setting a property or invoking one of its methods.

from damirscorner-utterances.

damirarh avatar damirarh commented on August 15, 2024

Imported comment written by Yury Yatskov on 2016-05-17T22:03:07

Override OnNavigatedTo - works!
Thank you!

from damirscorner-utterances.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.