开发者

Binding Silverlight Charts in Code Behind

开发者 https://www.devze.com 2023-03-16 02:05 出处:网络
I have a list of objects (custom) with two properties each (date, value) and I\'d like to bind this list to a LineSeries object.

I have a list of objects (custom) with two properties each (date, value) and I'd like to bind this list to a LineSeries object.

This is what I have so far...

        var series = new LineSeries();
        series.ItemsSource = this._storObj;  // This is the List<object>
        storage开发者_如何学编程Chart.Series.Add(series);

How do I tell the series what properties to use on the objects in the code-behind. I've seen many XAML examples but need to do this in the code behind.

Thanks!

Jeffrey Kevin Pry


Something like this maybe ?

series.DependentValueBinding = new Binding("NameOfYourValueProperty");
series.IndependentValueBinding = new Binding("Date");

Hope that helps ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消