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

Crash when closing RadPane created from Binding

4 Answers 78 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 23 Jun 2011, 08:28 AM
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?

4 Answers, 1 is accepted

Sort by
0
Accepted
Konstantina
Telerik team
answered on 28 Jun 2011, 09:24 AM
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
0
Muhammad Irfan
Top achievements
Rank 1
answered on 18 Aug 2011, 11:46 AM
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?
0
Konstantina
Telerik team
answered on 22 Aug 2011, 03:18 PM
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 >>

0
Muhammad Irfan
Top achievements
Rank 1
answered on 23 Aug 2011, 08:00 PM
Thank you Konstantina, this post really help.
Tags
Docking
Asked by
Thomas
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Muhammad Irfan
Top achievements
Rank 1
Share this question
or