【发布时间】:2017-10-24 02:37:57
【问题描述】:
我应该知道这一点,但找不到正确的信息。我试图让我的 Xamarin.Forms ListView 工作,我需要将 ItemsSource 设置为名为“theHerd”的局部变量,该变量的类型为 ObsverableCollection。这是我所拥有的,我需要如何对其进行更改才能使其正常工作?
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:HerdViewerPrototype" x:Class="HerdViewerPrototype.HerdViewerPrototypePage">
<ListView x:Name="lstview" ItemsSource="{local:theHerd}" />
</ContentPage>
【问题讨论】:
-
您没有发布任何代码。但通常您可以使用 DataBinding 在 XAML 中设置您的 ItemSource,或者只是在您的代码隐藏中分配它。
标签: c# xaml xamarin xamarin.forms