Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to DataBind to StackPanel?

$
0
0

Hi All

Really need you help?

I have a List of simple class objects in my code behind, which I want to data bind to a Stack Panel.

Simple Class

public class MyBook {

public string Name = "Physics";

public decimal Price = 9.99;

}

Window Code-Behind - Property

public List<MyBook> BookData {

get;

set;

}

In my XAML I have the following StackPanel, which I want to data bind the propertyBookData too.

<StackPanel x:Name="spBooks" Margin="10 0 0 0" ><Label Content="Book Name"></Label></StackPanel>

For each item in the List<MyBook>, I want to insert a Label within the Stack Panel.

Any help would really be appreciated, Thanks!


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>