Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Parameter in PushAsync of a TableView ?

$
0
0

Hello,
I have a TableView and when I click a Item I want to show a DetailPage.
So far it works, but I don't find a way to pass parameters to Navigation.PushAsync(page)
because I have to tell the DetailPage which item is clicked.

This is the TextCell from the TableView :

`
TextCell tc = new TextCell();
tc.Command = navigateCommand;
tc.CommandParameter = typeof(DetailPage);

`

This is the navigateCommand
`
Command navigateCommand =
new Command(async (Type pageType) =>
{
// Get all the constructors of the page type.
IEnumerable constructors =
pageType.GetTypeInfo().DeclaredConstructors;

                    foreach (ConstructorInfo constructor in constructors)
                    {
                        // Check if the constructor has no parameters.
                        if (constructor.GetParameters().Length == 0)
                        {
                            // If so, instantiate it, and navigate to it.
                            Page page = (Page)constructor.Invoke(null);
                            await this.Navigation.PushAsync(page);
                            break;
                        }
                    }
                });

`

Can anyone give me a hint how to do that ?

Best regards
stalle


Viewing all articles
Browse latest Browse all 58056

Trending Articles