This is a migrated thread and some comments may be shown as answers.

Trying to clear a binded ObservableCollection hangs app

7 Answers 269 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Magnus
Top achievements
Rank 2
Magnus asked on 08 Aug 2011, 02:31 PM
Hi.

I want to clear the collection that the Chart controls is bound to.
Based on the ExamplesCS_WP samples solution, the LiveFeed.xaml page, I add a button and on the click event of that button I reset the data bound collection:
private void btnReset_Click(object sender, RoutedEventArgs e)
{
  Deployment.Current.Dispatcher.BeginInvoke(() =>
    {
      this.indexItemsSource.Clear();
    });
}

But this hangs the entire app. I can't even use the back button.
Any ideas?

Regards,
Magnus

7 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 08 Aug 2011, 03:07 PM
Hi Magnus,

Thanks for writing and for reporting this issue.

Based on the information that you shared with us we cannot be sure what exactly causes the erroreous behavior. Could you please share with use some more XAML and C# code or possibly a sample project that we can use to reproduce the case so that we can better understand it and see how we can help.

Please note that in order to be able to attach a sample project you will have to open a new support ticket.

Thanks for your time.

Regards,
Deyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Magnus
Top achievements
Rank 2
answered on 08 Aug 2011, 03:35 PM
Hi Deyan.
Thanks for your reply.

Sure, i can open a support ticket. But really, it's very simple to just grab the Telerik ExamplesCS_WP solution, modify the Chart\Features\LiveFeed.xaml  to add a button:

In the Grid, add a row:
<Grid.RowDefinitions>
    <RowDefinition Height="Auto"/>
    <RowDefinition Height="Auto"/>
    <RowDefinition Height="Auto"/>
    <RowDefinition Height="*"/>
    <RowDefinition Height="Auto"/>
    <RowDefinition Height="100"/>
    <RowDefinition Height="Auto"/> <!-- <====Add this  -->
Add the button at the end of the grid:
      <Button x:Name="btnReset" Grid.Row="6" Content="Reset" Click="btnReset_Click"></Button>
    </Grid>
</local:ExampleControlBase

Add the code behind in LiveFeed.xaml.cs:
private void btnReset_Click(object sender, RoutedEventArgs e)
   {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
      {
        this.indexItemsSource.Clear();
      });
   }

And to avoid an exception because of an empty source collection in the OnTimer, check for any items exists:
    private void OnTimer(object sender, EventArgs e)
    {
      if (indexItemsSource.Count > 0)
      {
        this.indexItemsSource.RemoveAt(0);
        this.volumeItemsSource.RemoveAt(0);
      }
...
...

Run the Telerik Examples demo, navigate to "browse all controls"-> "Chart - Features" and click the reset button.

Hope this helps.

Regards,
Magnus
0
Deyan
Telerik team
answered on 10 Aug 2011, 08:01 AM
Hi Magnus,

Thanks for writing back and for the details.

I would like to inform you that I have been able to reproduce the issue. I will log it in our TODO system for fixing and we will provide a fix for it in our next major release.

In case this issue is a show-stopper for you, let me know and we will make sure to deliver an Internal Build containing a fix as soon as possible.

I have updated your Telerik points for bringing our attention to this issue.

Thanks for your time.

Regards,
Deyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Magnus
Top achievements
Rank 2
answered on 10 Aug 2011, 08:11 AM
Ok, that sounds great.
Yes, I'm very interested in an internal build, since I have actually submitted an app to the Market Place with similar functionality.
Needless to say, I would really have a majore release/fix as soon as possible.

I have also noted that binding a Chart to an empty ObservableCollection<> will pretty much create the same hang.
(So I suppose that's the main culprit)

Regards,
Magnus
0
Deyan
Telerik team
answered on 11 Aug 2011, 09:19 AM
Hello Magnus,

Thanks for writing back.

Since the developer responsible for the RadChart codebase is currently on vacation, we will be able to release an internal build in the next week.

Do not hesitate to get back to us in case you have further questions or need assistance.

All the best,
Deyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Accepted
Georgi
Telerik team
answered on 18 Aug 2011, 01:15 PM
Hi Magnus,

I would also like to thank you for bringing our attention to this issue.

I am excited to share that we have just released an update of our tools, which targets the new Mango version of WP7. In this release the issue is fixed and you should be able to safely clear the collection of business objects.

More information about the release may be found in this blog post.

Kind regards,
Georgi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Magnus
Top achievements
Rank 2
answered on 25 Aug 2011, 10:18 AM
Hi Georgi.

Yes, this new release fixed this problem.
Thanks.

Regards,
Magnus
Tags
Chart
Asked by
Magnus
Top achievements
Rank 2
Answers by
Deyan
Telerik team
Magnus
Top achievements
Rank 2
Georgi
Telerik team
Share this question
or