我试图在我的图表中查看ace的值,但我有以下错误“'IndependentValue'成员无效,因为它在chartinToolkit wpf中没有限定的类型名称“
这是我的代码
<Window x:Class="WpfToolkitChart.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="1031" Width="855" xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" FlowDirection="RightToLeft">
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0,-28,0,28">
<Grid Height="500">
<chartingToolkit:Chart Name="lineChart" Title="Line Series Demo" VerticalAlignment="Top" Margin="33,6,6,0" Height="440" Foreground="DarkRed" FlowDirection="LeftToRight" FontFamily="CPalatineLinoType">
<chartingToolkit:LineSeries DependentValuePath="Value" IndependentValuePath="Key" ItemsSource="{Binding}" IsSelectionEnabled="True"/>
<ToolTipService.ToolTip>
<StackPanel Margin="2,2,2,2">
<ContentControl Content="{TemplateBinding IndependentValue}" FontSize="12"/>
<ContentControl Content="{TemplateBinding DependentValue}" FontSize="12"/>
</StackPanel>
</ToolTipService.ToolTip>
</chartingToolkit:Chart>
</Grid>
</ScrollViewer>
字符串
请任何人帮助我,谢谢:)
4条答案
按热度按时间fxnxkyjh1#
以防有人在这里搜索错误消息,我得到它只是因为我错误地使用
x:Static
而不是StaticResource
来访问本地声明的资源。希望这对路上的人有所帮助。
gfttwv5a2#
只是以防有人需要眼镜,像我一样。
之前(XAML失败)
字符串
After(固定XAML)
型
我只需要把冒号改成点。
3zwjbxry3#
您看到此错误是因为您正在控件模板之外使用
TemplateBinding
。您只能在控件模板内使用该绑定类型。如果不增加更多的细节问题,我不知道你到底想达到什么目的。
您可以在this other answer上看到一个适当使用
TemplateBinding
的示例。wh6knrhe4#
我用这个代码解决了这个问题。
字符串