问题
Possible Duplicate:
Accessing static fields in XAML
I have one static class with two static properties inside. For example:
public static class myStaticClass
{
public static A a;
public static B b;
}
public class A
{
public ObservableCollection<Person> persons;
public struct Person
{
private string mame;
public string Name
{
get; set;
}
}
}
public class B
{
public ObservableCollection<Coord> coords;
public struct Coord
{
private string address;
public string Address
{
get; set;
}
}
I initialize and fill myStaticClass.a and myStaticClass.b and I want bind properties (a, b) with listbox, which contains two textboxes (One textbox bind to person Name and the second with Address).
Could you help me please do it.
Thanks.
回答1:
See the accepted answer in this question. In essence, you need to use x:Static
in your XAML.
来源:https://stackoverflow.com/questions/11959788/xaml-binding-to-static-classes