Crash when closing RadPane created from Binding

5 posts, 1 answers
  1. Thomas
    Thomas avatar
    17 posts
    Member since:
    Jan 2011

    Posted 23 Jun 2011 Link to this post

    Hi,
    I have a problem with RadPaneGroup. I want to create RadPanes dynamically via a binding on ItemsSource of RadPaneGroup. The list for the binding is a ObservableCollection<RadPane>. Everything works as expected until it want to close these RadPanes and click on the "x"-button. The program crashes instantly with the following exception:
    "Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead."

    We use version 2011.1.315.35 of the Telerik components.

    Viewmodel base:
    public class ViewModelBase : INotifyPropertyChanged
    {
      public String DisplayName { get; set; }
     
      protected void RaisePropertyChanged(string propertyName)
      {
        if (PropertyChanged != null)
        {
          PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
      }
     
      public event PropertyChangedEventHandler PropertyChanged;
    }

    Viewmodel:
    public class TestViewModel : Model.ViewModelBase
    {
      private ObservableCollection<RadPane> m_PaneList = new ObservableCollection<RadPane>();
     
      public ObservableCollection<RadPane> PaneList
      {
        get { return m_PaneList; }
        set
        {
          m_PaneList = value;
          RaisePropertyChanged("PaneList");
        }
      }
    }

    Docking definition in XAML:
    <telerik:RadDocking Grid.Row="1" HasDocumentHost="True" HorizontalAlignment="Stretch" Name="radDocking1" VerticalAlignment="Stretch">
      <telerik:RadSplitContainer>
        <telerik:RadPaneGroup Name="radPaneGroup1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding Path=PaneList}">
        </telerik:RadPaneGroup>
      </telerik:RadSplitContainer>
    </telerik:RadDocking>

    Creation of the RadPanes:
    TestViewModel testViewModel = this.DataContext as TestViewModel;
    RadPane pane = new RadPane {Header = "Test"};
    if (testViewModel != null)
    {
      testViewModel.PaneList.Add(pane);
    }
     
    Am I doing anything wrong here?
  2. Answer
    Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 28 Jun 2011 Link to this post

    Hi Thomas,

    The ItemsSource property is not supported. Please use instead the Items property of the RadPaneGroup. For a complete list of all unsupported properties please refer to this help article.

    Greetings,
    Konstantina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Muhammad Irfan
    Muhammad Irfan avatar
    18 posts
    Member since:
    Jan 2010

    Posted 18 Aug 2011 Link to this post

    Hi Konstantina,
    So its mean we can't use MVVM bindings in RadDocking? Is there any other alternative to dynamically create and then bind RadPanes to RadDocking?
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 22 Aug 2011 Link to this post

    Hello Muhammad,

    You can find an example how to implement RadDocking and MVVM pattern in this forum post.

    Hope this helps.

    Greetings,
    Konstantina
    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 >>

  6. Muhammad Irfan
    Muhammad Irfan avatar
    18 posts
    Member since:
    Jan 2010

    Posted 23 Aug 2011 Link to this post

    Thank you Konstantina, this post really help.
Back to Top
UI for WPF is Visual Studio 2017 Ready