WPF binding with Datacontext

Viewed 4744

I'm new to WPF programming and I have this question going through my mind.

Why does binding only work when using properties instead of fields?

Here's the example that gave me this question:

xaml:

<ListBox ItemsSource="{Binding requiredPermissions}" DisplayMemberPath="MyText" Grid.Row="1" ></ListBox>

code behind(works):

public ObservableCollection<MyNotifyableText> requiredPermissions { get; set; }

code behind (doesn't work):

public ObservableCollection<MyNotifyableText> requiredPermissions; 

Thanks in advance.

2 Answers
Related