自定义一个Converter,在其中的方法中,根据坐标的值,去数据源查询数据:
- public class MyDataPointConverter : IValueConverter
- {
- public MyDataPointConverter()
- {
- }
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- return "Here display other data queried from the data source!";
- }
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- return null;
- }
- }
复制代码
前台代码稍作修改:
添加声明:
- xmlns:local ="clr-namespace:ChartSamples"
复制代码
- <local:MyDataPointConverter x:Key="fc" />
复制代码
|