-1

我有 BindableProperty 的这个问题,我正在做一个 GPS 项目,我找不到解决方案imageFromMyProjectHere

4

1 回答 1

0

这是因为 CaculateCommand 不是 ContentPage 的属性。

您可以在其他页面访问。

第 14 页:其中包括 CaculateCommand 属性。

   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);
    }
     
     //........
}

第15页.cs:

   public partial class Page15 : Page14

第15页xml:

  <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>
于 2021-10-12T06:40:19.380 回答