我使用了杰瑞的技术:
App-wide Observable Collection
并收到编译错误CS0176,并显示以下消息:
会员' Page.Items'无法使用实例引用访问;用类型名称来限定它。
我正在尝试x:绑定到ObservableCollection项目。
任何人都知道如何解决此错误。
感谢
答案 0 :(得分:2)
So, I just double-checked, this time with cordova platform
.
This is the code:
x:bind
And this is the XAML:
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; } }
}
Works like a charm. Looks like this:
So, I am not sure why you are seeing this error. But, to your question, there is no fix because this works. If you figure out the problem you were getting be sure and follow-up with a comment. Otherwise, best of luck!