2016-02-12 64 views

回答

2

所以,我只是双重检查,这次x:bind

这是代码:

public class x 
{ 
    public static ObservableCollection<string> Items { get; } = new ObservableCollection<string>(); 
} 

public sealed partial class MainPage : Page 
{ 
    public MainPage() 
    { 
     InitializeComponent(); 
    } 

    public ObservableCollection<string> Items { get { return x.Items; } } 
} 

这是XAML:

<!-- page content --> 
<StackPanel Grid.Row="1" VerticalAlignment="Top" Orientation="Horizontal" 
      Padding="12,8,0,0"> 

    <ListView ItemsSource="{x:Bind Items}" /> 

</StackPanel> 

就像一个魅力。看起来是这样的:

enter image description here

所以,我不知道为什么你看到这个错误。但是,对于你的问题,没有解决办法,因为这有效。如果你发现问题得到确认,并随后发表评论。否则,祝你好运!

+0

谢谢杰里它的工作,我错过了{get; }定义ObservableCollection 项目时。 – TriM

相关问题