Blocker bug!!! Binding ListBox to QueryableDataServiceCollectionView crush application

7 posts, 0 answers
  1. Mark
    Mark avatar
    12 posts
    Member since:
    Nov 2011

    Posted 27 Aug 2012 Link to this post

    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();
                }
            }
     
        }
    }



  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 27 Aug 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Mark
    Mark avatar
    12 posts
    Member since:
    Nov 2011

    Posted 27 Aug 2012 Link to this post

    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. :)

  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 28 Aug 2012 Link to this post

    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.

  6. Mark
    Mark avatar
    12 posts
    Member since:
    Nov 2011

    Posted 28 Aug 2012 Link to this post

    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


  7. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 28 Aug 2012 Link to this post

    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.

  8. Mark
    Mark avatar
    12 posts
    Member since:
    Nov 2011

    Posted 28 Aug 2012 Link to this post

    support ticket is 584550 
Back to Top
UI for WPF is Visual Studio 2017 Ready