2016-08-24 76 views
0

我想查看我圖表中的aces值,但我有以下錯誤 「'IndependentValue'成員無效,因爲它不chartinToolkit WPF「'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> 

請攜載任何一個可以幫助我這個 謝謝:)

+0

問題主要在xaml我解決了thx :) –

回答

0

我已經通過這個代碼解決了這個問題

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

萬一有人土地在這裏尋找的錯誤信息,我只是因爲我錯誤地使用x:Static代替StaticResource訪問局部聲明的資源得到它。

希望這可以幫助路上的人。

相關問題