How to set ItemsSource value of ColumnSeries?

gotqn

I am not able to set ItemsSource value of ColumnSeries. I am following some examples (this and this) but they seem to be out dated.

Here is my XAML:

<Charting:Chart x:Name="ColumnChart"
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                Width="Auto"
                Height="Auto">
    <Charting:ColumnSeries Title="Georgi Kyuchukov"
                           Margin="0"
                           Name="ColumnChartSeries"
                           IndependentValuePath="Name"
                           DependentValuePath="Pts"
                           IsSelectionEnabled="True" />
</Charting:Chart>

and here is my C# code:

public class ChartData
{
    public string Name { get; set; }
    public int Pts { get; set; }
}

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    List<ChartData> personalData = (List<ChartData>)e.Parameter;

    foreach (ChartData x in personalData){
        Debug.WriteLine(x.Name + " " + x.Pts);
    }

    (ColumnChart.Series[0] as ColumnSeries).ItemsSource = personalData;
    //ColumnChartSeries.ItemsSource = personalData;
}

I am getting the following error:

Error 1 The type or namespace name 'ColumnSeries' could not be found (are you missing a using directive or an assembly reference?)

I have also try:

ColumnChartSeries.ItemsSource = personalData;

But get:

An exception of type 'System.NullReferenceException' occurred in gotqn.exe but was not handled in user code.

Also, I am getting the following error often:

Error 1 A value of type 'ColumnSeries' cannot be added to a collection or dictionary of type 'Collection`1'.

but I am able to run the application, so I guess it is not critical.

Could you tell what I am doing wrong?

Also, I will be grateful for being given some good up-to-dated documentation link/article.

Filip Skakun

Perhaps you're missing this in your code behind...

using WinRTXamlToolkit.Controls.DataVisualization.Charting;

Try moving your cursor to ColumnSeries and press Alt+Shift+F10 to add the missing namespace. Or simply use Alt+Enter if you have ReSharper (which I recommend).

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

ColumnSeriesのItemsSource値を設定する方法は?

分類Dev

How to get Items from ItemsSource?

分類Dev

How to set any value to interface{}

分類Dev

How to set DatePickerDialog value to EditText?

分類Dev

How to set value to const in react

分類Dev

How to set form value to NULL

分類Dev

How to set bool value in SQL

分類Dev

How to set limit value dynamic?

分類Dev

How to Set a value with words and Cells

分類Dev

How to set value to a property in Scala

分類Dev

How to set a default value in react-select

分類Dev

How to set checkbox with a certain value checked in jquery?

分類Dev

How to get and set value of <text> element in SVG?

分類Dev

How to set default value to dc selectMenu

分類Dev

How to set maximum numeric value for SQL variable?

分類Dev

How to set initial value for Event Emitter

分類Dev

How to set up value for serial type in PostgreSQL?

分類Dev

How to set value to SCSS variables from HTML?

分類Dev

How set a value from terminal linux?

分類Dev

How to set initial value for primary key in migration?

分類Dev

How to set a variable value to zero each row

分類Dev

How to set the value of checkbox to false in first run

分類Dev

KnockoutJS how to programmatically set value in dropdown

分類Dev

how to set TextBox value as textfile name

分類Dev

how to set and get value of jquery buttons

分類Dev

How to dynamicly set select value with php/html

分類Dev

How to set initial value for select element in AngularJS?

分類Dev

How to set value of RadGridView's column programmatically

分類Dev

How to not conflate a spec'ed map's key set and value set?

Related 関連記事

ホットタグ

アーカイブ