-1

I have this problem with BindableProperty, I am working on a GPS Project and I cannot find the solution imageFromMyProjectHere

  • 1
    You've set the DataContext to be MapViewModel so thats where it's looking for the ICommand propperty, not in the code behind. Also in future please provide actual code in your question. Screenshots break and screenshots can't be copy pasted... – T.Schwarz Oct 11 '21 at 06:31
  • 2
    welcome to stackoverflow. please include code, error messages, and other _text-based_ information ***as text***, not as screenshot. i recommend [taking the tour](https://stackoverflow.com/tour), as well as reading [how to ask a good question](https://stackoverflow.com/help/how-to-ask) and [what's on topic](https://stackoverflow.com/help/on-topic). – Franz Gleichmann Oct 11 '21 at 06:39

1 Answers1

0

It caused by that the CaculateCommand is not the property of ContentPage.

You could access in other page.

Page14: which include the CaculateCommand property.

   public partial class Page14 : ContentPage
{

    public static readonly BindableProperty CaculateCommandProperty = BindableProperty.Create(nameof(CaculateCommand), typeof(Command), typeof(Page14), null, propertyChanged: HandleCaculateCommandChanged);

    private static void HandleCaculateCommandChanged(BindableObject bindable, object oldValue, object newValue)
    {

    }
    public Command CaculateCommand
    {
        get => (Command)GetValue(CaculateCommandProperty);
        set => SetValue(CaculateCommandProperty, value);
    }
     
     //........
}

Page15.cs:

   public partial class Page15 : Page14

Page15 xaml:

  <local:Page14  xmlns:local="clr-namespace:App14" xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"  
           x:Class="App14.Page15"
          CaculateCommand="{Binding CaculateRouteCommand}">

  </local:Page14>
Wendy Zang - MSFT
  • 10,509
  • 1
  • 7
  • 17