Canon Cygnus Canon Cygnus - 1 year ago 55
C# Question

x:Bind works but Binding doesn't (opposite to most Q&A found)

Most of the Q&A I found on StackOverflow is how Binding work but

doesn't which usually solved by
. However, my issue is, inside a
ItemSource="{x:Bind _myList}"
works but
ItemSource="{Binding _myList}"

Why? And how do I make Binding work? (instead of

Here's a few code thingies:


public class MyClass
public string prop1 {get; set;}
public string prop2 {get; set;}

public class MyList : List<MyClass>
public void Populate()
// Add items

Code Behind

public MyList _myList = new MyList();
DataContext = this;

XAML (doesn't work here but works if ItemSource: changed into
x:Bind _myList

<GridView ItemSource="{Binding _myList}">
<TextBlock Text="{Binding prop1}"/> <TextBlock Text="{Binding prop2}/>

Answer Source

The problem that your _myList is field, not property. So, change to

public MyList _myList { get; set; } = new MyList();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download