Answer the question
In order to leave comments, you need to log in
What is the correct way to bind an array in WPF?
The point is this. There are two classes: Cart and Item:
public class Cart
{
public Item[] Items { get; set; }
public double Price { get; set; }
}
public class Item
{
public int Id { get; set; }
public string Description { get; set; }
<ListBox ItemsSource="{StaticResource cart}" Width="350" Margin="0,5,0,10">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Id}" />
<TextBlock Text=", " />
<TextBlock Text="{Binding Descritpion}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question