We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem with DataBinding to Series

Thread ID:





123468 Mar 20,2016 10:58 PM UTC Mar 22,2016 10:33 AM UTC WPF 3
Tags: SfChart
Melvin Smith
Asked On March 20, 2016 10:58 PM UTC

I have a treeview and when I click on an item I want to refresh a WPF default grid and also a sfchart control. My XAML Looks like this:

        <viewModel:VMmainWindow />
    <Grid Margin="0,10,2,0">
        <DataGrid x:Name="dataGrid" Margin="0,10,218,329" ItemsSource="{Binding SelectedStock.StockData}" HorizontalAlignment="Right" Width="405" />
        <syncfusion:TreeViewAdv ItemsSource="{Binding Indices}" SelectedTreeItem="{Binding SelectedStock}" Margin="10,10,628,329">
                <HierarchicalDataTemplate ItemsSource="{Binding Stocks}">
                    <TextBlock Text="{Binding Symbol}" />
        <DockPanel HorizontalAlignment="Left" Height="314" LastChildFill="False" Margin="10,235,0,0" VerticalAlignment="Top" Width="770">
            <syncfusion:SfChart x:Name="Chart"   Margin="5,0,10,0">
                    <syncfusion:DateTimeAxis  Header="Date"/>
                    <syncfusion:NumericalAxis  Header="Value"/>
                <syncfusion:LineSeries  x:Name="series1" XBindingPath="Date" YBindingPath="Close" ItemsSource="{Binding SelectedStock.StockData}"/>

My ViewModel:
    public class VMmainWindow
        public List<Model.Index> Indices { get; set; }
        public Model.Stock SelectedStock { get; set; }
        public VMmainWindow()
            this.Indices = new List<Model.Index>();
            this.Indices.Add(new Model.Index());

For the moment I haven't implemented INotifyPropertyChanged in my model classes though the datagrid is already correctly updated when I Change the selection in the treeview, but the sfchart isn't (stays empty).
What can I do that this works?
Thanks in advance!


Sumathi Jayaraj [Syncfusion]
Replied On March 21, 2016 04:33 PM UTC

Hi Melvin,

Thanks for contacting Syncfusion Support.

We are unable to reproduce your reported problem. Please provide us more information probably a sample to reproduce the reported issue.

Sumathi J

Melvin Smith
Replied On March 21, 2016 05:52 PM UTC

Hi Sumathi,
I attached a zip Folder with my solution.
You will see that selecting an item in the treeview will refresh the grid, but not the Chart. Could you tell me why this isn't the case ?
Best regards

Attachment: HistoricalStockDataGetter_b54ee62d.zip

Sumathi Jayaraj [Syncfusion]
Replied On March 22, 2016 10:33 AM UTC

Hi Melvin,
Thanks for the update.
The problem occurs because the Window and SfChart are having their own DataContext. We have resolved the problem in the sample by removing DataContext from SfChart. Please find the modified sample from the below location.
Sample: HistoricalStockDataGetter
Sumathi J


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon