Can I Rebind Chart with asynchronous way?

2 posts, 0 answers
  1. yiwei
    yiwei avatar
    1 posts
    Member since:
    Jul 2011

    Posted 26 Aug 2011 Link to this post

    Hi,

    I have a method that use asynchronous way.

    I want to update the PaletteBrushes when some data has already been prepared.

    But the PaletteBrushes doesn't updated after i invoke the  asynchronous method.

    Is there any way to meet my requirement?

    Thanks
  2. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 31 Aug 2011 Link to this post

    Hello Yiwei,

    You can rebind the chart to handle this scenario. This may look something like this:

    public CurrentIssue()
          {
              InitializeComponent();
     
              RadChart.ItemsSource = new int[] {123, 4, 5, 6, 7, 78};
     
              DispatcherTimer timer = new DispatcherTimer();
              timer.Interval = new TimeSpan(0, 0, 3);
              timer.Start();
              timer.Tick += new EventHandler(timer_Tick);
          }
     
          void timer_Tick(object sender, EventArgs e)
          {
              RadChart.PaletteBrushes.Clear();
              RadChart.PaletteBrushes.Add(new SolidColorBrush(Colors.Red));
              RadChart.Rebind();
              (sender as DispatcherTimer).Stop();
          }

    I hope this information helps.

    Best wishes,
    Yavor
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top