Ok, this is in response to your response (which some mod will move to a comment, or to your original question). You now have:
<ListBox Height="367" HorizontalAlignment="Left" Name="listRelations"
VerticalAlignment="Top" Width="254">
<DataTemplate>
<TextBlock Name="txtName" Text="Binding UserName" />
</DataTemplate>
</ListBox>
Can you see what's wrong there? You are inadvertently setting the
Items
property by adding a
DataTemplate
as an item in your
ListBox
's
Items
collection. The correct code is:
<ListBox Height="367" HorizontalAlignment="Left" Name="listRelations"
VerticalAlignment="Top" Width="254">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Name="txtName" Text="{Binding UserName}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>