Hi,
I modified the Syncfusion.Tools.Silverlight.Samples.TreeViewDataBindingDemo this way:
// Place the initialisation code in a procedure.
ObservableCollection
itemsSource = new ObservableCollection();
private void Initialize()
{
var temp = new ObservableCollection()
{
new ObjectModel("Division 1",
new ObjectModel("Director Fire & Life Safety", new ObjectModel("Asst Dr.Emergency Preparedness"),new ObjectModel("Fire Safety Specialist")),
new ObjectModel("Director Security",new ObjectModel("Medical Security"),new ObjectModel("Campus Security")),
new ObjectModel("Manager Training & Accreditation"),new ObjectModel("Director Police Operations",new ObjectModel("Staff Assistant"),new ObjectModel("Patrol Captain",new ObjectModel("Commander Sergeant",new ObjectModel("Police Officers"))),new ObjectModel("Asst Dr,Investigations",new ObjectModel("Directives Investigator"))),new ObjectModel("Director Operations")),
new ObjectModel("Division 2",
new ObjectModel("Director Security"),
new ObjectModel("Asst Director Security"),
new ObjectModel("Asst Director Campus Security")),
new ObjectModel("Division 3",
new ObjectModel("Teaching Professional",
new ObjectModel("Co-ordinator"))),
};
itemsSource.Clear();
foreach (var item in temp)
itemsSource.Add(item);
}
// Call this procedure in the constructor, before InitializeComponent();
Everything works fine.
Then, I added a button, with the following code :
private void Button_Click(object sender, RoutedEventArgs e)
{
Initialize();
}
When I click the button, I get a very nasty error message (see attachment).
Looks like it's not possible to modify the collection after the binding has been established.
Am I doing something wrong ?
(I need this feature in my application, where the datasource can be updated by a Web Service)
Thanks in advance for you help.
Philippe
(Essential Suite 8.1.0.30)
Snap5_78741d6c.zip