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