Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I bind to an element within a list, within a observable collection?
    primarykey
    data
    text
    <p>I have the following problem:</p> <p>I have an ObservableCollection as my model, which looks like this:</p> <pre><code>public class HistoryViewModel : ViewModelBase { private ObservableCollection&lt;List&lt;KeyValuePair&lt;DateTime, float&gt;&gt;&gt; _valuePairs; public ObservableCollection&lt;List&lt;KeyValuePair&lt;DateTime, float&gt;&gt;&gt; ValuePairs { get { return this._valuePairs; } set { this._valuePairs= (ObservableCollection&lt;List&lt;KeyValuePair&lt;DateTime, float&gt;&gt;&gt;)value; OnPropertyChanged("ValuePairs"); } } } </code></pre> <p>As you can see this collection consists of lists, i need to bind to the KeyValuePair in the list. But i don't know how. The problem is I cannot know how many items will be in the collection nor in the list.</p> <p>my attempt right now looks like this:</p> <pre><code>&lt;ItemsControl ItemsSource="{Binding Path=ValuePairs}"&gt; &lt;ItemsControl.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;StackPanel&gt;&lt;/StackPanel&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ItemsControl.ItemsPanel&gt; &lt;ItemsControl.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;charting:Chart Width="400" Height="250"&gt; &lt;charting:Chart.Series&gt; &lt;charting:LineSeries Title="Monthly Count" IndependentValueBinding="{Binding //, Path=Key}" DependentValueBinding="{Binding //, Path=Value}"&gt; &lt;/charting:LineSeries&gt; &lt;/charting:Chart.Series&gt; &lt;/charting:Chart&gt; &lt;/DataTemplate&gt; &lt;/ItemsControl.ItemTemplate&gt; &lt;/ItemsControl&gt; </code></pre> <p>It displays how much elements are in the collection, but the chart does not show any values. Any ideas?</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload