0
我正在使用WPF工具包的圖表,但我遇到了將它綁定到ViewModel的問題。什麼都沒有出現。如果你想知道,我有MainWindow.DataContext = MainWindowViewModel。這是我有:WPF綁定問題
MainWindow.xaml
<chartingToolkit:Chart Grid.Row="2">
<chartingToolkit:ColumnSeries Name="line_chart"
IndependentValuePath="Key"
DependentValuePath="Value"
ItemsSource="{Binding Me}"/>
</chartingToolkit:Chart>
MainWindowViewModel.cs
class MainWindowViewModel
{
public List<KeyValuePair<string, int>> Me { get; set; }
public MainWindowViewModel(Model model)
{
this.model = model;
me.Add(new KeyValuePair<string, int>("test", 1));
me.Add(new KeyValuePair<string, int>("test1", 1000));
me.Add(new KeyValuePair<string, int>("test2", 20));
me.Add(new KeyValuePair<string, int>("test3", 500));
}
Model model;
List<KeyValuePair<string, int>> me = new ObservableCollection<KeyValuePair<string,int>>();
}
我是個白癡......甚至沒有趕上。謝謝,完美的作品! – keelerjr12 2014-12-11 02:39:32
沒問題,不客氣。 :) – 2014-12-11 02:43:22