“IndependentValue”成员无效,因为它在 chartinToolkit wpf 中没有合格的类型名称

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39120521/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 13:54:57  来源:igfitidea点击:

'IndependentValue' member is not valid because it does not have a qualifying type name in chartinToolkit wpf

wpfxamlchartstooltipwpftoolkit

提问by shaymaa adel

i am trying to view the value of aces in my chart but i have the following error "'IndependentValue' member is not valid because it does not have a qualifying type name in chartinToolkit wpf "

我正在尝试查看图表中 ace 的值,但出现以下错误“'IndependentValue' 成员无效,因为它在 chartinToolkit wpf 中没有限定类型名称”

this is my code

这是我的代码

    <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>

please cany any one help me in this thanks :)

请任何人帮助我,谢谢:)

采纳答案by shaymaa adel

i had solved the problem by this code

我已经通过这段代码解决了这个问题

<chartingToolkit:LineSeries.DataPointStyle>
    <Style TargetType="chartingToolkit:DataPoint">
        <Setter Property="Background" Value="#0077CC" />
        <Setter Property="BorderBrush" Value="White"/>
        <Setter Property="BorderThickness" Value="2"/>
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="chartingToolkit:LineDataPoint">
                    <Grid x:Name="Root" Opacity="1">
                        <ToolTipService.ToolTip>
                            <StackPanel Margin="2,2,2,2">
                                <ContentControl Content="{TemplateBinding IndependentValue}" ContentStringFormat="Date : {0}"/>
                                <ContentControl Content="{TemplateBinding DependentValue}" ContentStringFormat="Count : {0:###,###,###}"/>
                            </StackPanel>
                        </ToolTipService.ToolTip>
                        <Ellipse StrokeThickness="{TemplateBinding BorderThickness}" Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</chartingToolkit:LineSeries.DataPointStyle>

回答by dotNET

Just in case someone lands here searching for the error message, I was getting it simply because I was mistakenly using x:Staticinstead of StaticResourceto access a locally declared resource.

以防万一有人在这里搜索错误消息,我得到它只是因为我错误地使用x:Static而不是StaticResource访问本地声明的资源。

Hope this helps someone down the road.

希望这可以帮助别人。