Building Xamarin.Forms Mobile Apps Using XAML by Dan Hermes & Nima Mazloumi

Building Xamarin.Forms Mobile Apps Using XAML by Dan Hermes & Nima Mazloumi

Author:Dan Hermes & Nima Mazloumi
Language: eng
Format: epub
ISBN: 9781484240304
Publisher: Apress


CommandParameters

Now that you can bind the Command property of Button to your MyCommand, it’s time to pass in a parameter. Begin with passing the “Hello” string into your command via CommandParameter. Replace the line containing the Command definition in Listing 5-6 to pass value s into the Command and display it in the Writeline. MyCommand = new Command<string>(s => {Console.WriteLine(s); });

MyCommand now expects a string command parameter in s and writes the string to the Console. Working from Listing 5-7, pass your old “Hello” into the Button’s CommandParameter attribute. <Button Text="Click Me" Command="{Binding MyCommand}" CommandParameter="Hello">



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.