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

Blocker bug!!! Binding ListBox to QueryableDataServiceCollectionView crush application

6 Answers 48 Views
DataServiceDataSource
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 27 Aug 2012, 08:16 AM
The binding Microsoft ListBox or Telerik ListBox crush application because it set CurrentPosition to wrong value when collection is empty. I hope this problem will be fixed pretty soon.

This binding raise exception in ItemsControlSelector (see bug1.png)
<telerik:RadListBox x:Name="ContentItemsControl" ItemTemplate="{StaticResource GoalSimpleViewTemplate}"
                    ItemsSource="{Binding Path=ItemsSource, ElementName=MainControl }"
                    SelectedItem="{Binding Path=SelectedItem, ElementName=MainControl }">
</telerik:RadListBox>

Binding to Microsoft ListBox expose source of the problem in QueryableCollectionView (see bug2.png) 
<ListBox x:Name="ContentItemsControl" ItemTemplate="{StaticResource GoalSimpleViewTemplate}"
                            ItemsSource="{Binding Path=ItemsSource, ElementName=MainControl }"
                            SelectedItem="{Binding Path=SelectedItem, ElementName=MainControl }">
        </ListBox>

Code for model taken from Telerik WPF example
    public class MainViewModel : BaswViewModel, INavigationAware
    {
        private QueryableDataServiceCollectionView<Goal> _goals;
        private Goal _selectedGoal;
        private bool _isGoalsBusy = true;
 
        public MainViewModel(IEventAggregator eventAggregator, IRegionManager regionManager, IConnectionService connectionController, IOptionsService optionsService)
            : base(eventAggregator, regionManager, connectionController, optionsService)
        {
        }
 
        public IEnumerable<Goal> Goals
        {
            get { return IsGoalsBusy ? null : _goals; }
        }
 
        public bool IsGoalsBusy
        {
            get { return _isGoalsBusy; }
            set
            {
                if (_isGoalsBusy != value)
                {
                    _isGoalsBusy = value;
                    RaisePropertyChanged("IsGoalsBusy");
                }
            }
        }
 
        public Goal SelectedGoal
        {
            get { return _selectedGoal; }
            set
            {
                if (_selectedGoal != value)
                {
                    _selectedGoal = value;
                    RaisePropertyChanged("SelectedGoal");
                }
            }
        }
 
        public bool IsNavigationTarget(NavigationContext navigationContext)
        {
            SelectedGoal = null;
            SelectedActivity = null;
            return true;
        }
 
        public void OnNavigatedFrom(NavigationContext navigationContext)
        {
        }
 
        public void OnNavigatedTo(NavigationContext navigationContext)
        {
        }
 
        protected override void OnModelChanged()
        {
            base.OnModelChanged();
 
            if (Context != null)
            {
                UIDispatcher.BeginInvoke(() => { Initialize(); });
            }
        }
 
        private void Initialize()
        {
            _goals = new QueryableDataServiceCollectionView<Goal>(Context, Context.Goals);
            _goals.PropertyChanged += this.OnGoalsViewPropertyChanged;
            _goals.LoadedData += this.OnGoalsViewLoadedData;
            _goals.PageSize = 10;
            _goals.AutoLoad = true;
 
            RaisePropertyChanged("Goals");
        }
 
        private void OnGoalsViewPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "IsBusy")
            {
                this.IsGoalsBusy = _goals.IsBusy;
            }
        }
 
        private void OnGoalsViewLoadedData(object sender, LoadedDataEventArgs e)
        {
            if (e.HasError)
            {
                e.MarkErrorAsHandled();
            }
        }
 
    }
}



6 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 27 Aug 2012, 08:32 AM
Hello,

Can you send us a very small runnable dummy project that reproduces this exception. You can use Northwind or AdventureWorks sample DB's since we already have them. You can open a new support ticket and attach the sample project there. We will do our best to investigate what is going on.

Thanks in advance.

Regards,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Mark
Top achievements
Rank 1
answered on 28 Aug 2012, 02:16 AM
Done. I hope you will make patch ASAP.

P.S. It will be easy for you change your RadGridView to ListBox in your example to reproduce problem. :)

0
Vlad
Telerik team
answered on 28 Aug 2012, 05:51 AM
Hello,

 We've not received any project demonstrating the issue so far.

Greetings,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Mark
Top achievements
Rank 1
answered on 28 Aug 2012, 08:07 AM
Damn there is no way to attach zip file to the thread because of error "Incorrect file type. Please choose another file." and I cannot reach your email too. :-/ 

Please you following link to download example:
https://rapidshare.com/files/3066221343/TelerikBug.rar


0
Rossen Hristov
Telerik team
answered on 28 Aug 2012, 08:13 AM
Hello,

As I mentioned in my previous post: "You can open a new support ticket and attach the sample project there."

Please, do that. Thank you.

Greetings,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Mark
Top achievements
Rank 1
answered on 28 Aug 2012, 08:32 AM
support ticket is 584550 
Tags
DataServiceDataSource
Asked by
Mark
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Mark
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or