job.answiz.com
  • 0
Votes
name

I have the following snippet for a tablesection:

< TableRoot>
    < TableSection Title="First Section">
        < TextCell Text="TextCell 1">
            < TapGestureRecognizer Command="{Binding Source={x:Reference this}, Path=MyCommand}" CommandParameter="{value1}">
        < /TextCell>
        < TextCell Text="TextCell .... n">
            < TapGestureRecognizer Command="{Binding Source={x:Reference this}, Path=MyCommand}" CommandParameter="{value..n}">
        < /TextCell>            
    < /TableSection>
  < /TableRoot>    

and in my viewmodel, I have the following binding:

    public Command MyCommand
    {
        get
        {
            return new Command(p => {
                // option 1
                var name = p.ToString();
                Debug.WriteLine("Here we are ... " + name);
            });
        }
    }

when I compile, I keep getting the following error...

Cannot set the content of the TextCell as it doesn't have a ContentPropertyAttribute

Basically, when I click on the TableCell, in my function MyCommand, I want to send in the value from CommandParameter.

Any help you can provide I would appreciate. Thanks

 

Try this code. It might be helps :

     < TableRoot>
    < TableSection Title="First Section">
        < TextCell Text="TextCell 1">
           < TextCell>
               < TapGestureRecognizer Command="{Binding Source={x:Reference this}, Path=MyCommand}" CommandParameter="{value1}">
           < /TextCell.GestureRecognizers>
        < /TextCell>
        < TextCell Text="TextCell .... n">
            < TextCell>
                 < TapGestureRecognizer Command="{Binding Source={x:Reference this}, Path=MyCommand}" CommandParameter="{value..n}">
            < /TextCell.GestureRecognizers>
        < /TextCell>            
    < /TableSection>
  < /TableRoot> 
  • 1
Reply Report