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:
Viewmodel:
Docking definition in XAML:
Creation of the RadPanes:
Am I doing anything wrong here?
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?