在不是来自 ItemsSource 的 ListView 中访问 属性

Access property in ListView that is not coming from ItemsSource

我的 ListView 绑定到 MyTexts 列表。尽管如此,我需要将 TextCell's Text 绑定到不是来自 Texts (StandAloneProperty) 的 属性。我该怎么做?

<ListView
            SelectedItem="{Binding SelectedText, Mode=TwoWay}"
            ItemsSource="{Binding MyTexts}">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <TextCell
                        Text="{Binding StandAloneProperty, StringFormat='Value: {0}'}"
                        TextColor="{Binding Color}"
                    />                    
                </DataTemplate>
            </ListView.ItemTemplate>
</ListView>

将您的绑定 Source 设置为当前页面,并从 BindingContext(即您的 ViewModel)访问 StandAloneProperty

<ContentPage x:Name="pageRef"
...

<ListView
            SelectedItem="{Binding SelectedText, Mode=TwoWay}"
            ItemsSource="{Binding MyTexts}">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <TextCell
                        Text="{Binding Source={x:Reference pageRef} Path=BindingContext.StandAloneProperty, StringFormat='Value: {0}'}"
                        TextColor="{Binding Color}"
                    />                    
                </DataTemplate>
            </ListView.ItemTemplate>
</ListView>