This question is locked. New answers and comments are not allowed.
Hello,
I was trying to add user control or radBookItem by programming, using methods radBook.Items.Add method and radBook.Items.remove/removeAt/removeAll.
I created the radBook in xaml, then add the item in C#.
When it add the item(s), the radBook works fine.
The number of items in the radBook returned right number too.
But when I try to remove it (removeAll/removeAt(0)/remove) it will gaves me exception saying that the argument is out of range.
If I add the item though xaml, it has no problem with removing it.
But the point is that I need to create the pages dynamically in C#.
Is there something I did wrong?
Debug Log:
Exception:
Specified argument was out of the range of valid values.
Parameter name: index
I was trying to add user control or radBookItem by programming, using methods radBook.Items.Add method and radBook.Items.remove/removeAt/removeAll.
I created the radBook in xaml, then add the item in C#.
When it add the item(s), the radBook works fine.
The number of items in the radBook returned right number too.
But when I try to remove it (removeAll/removeAt(0)/remove) it will gaves me exception saying that the argument is out of range.
If I add the item though xaml, it has no problem with removing it.
But the point is that I need to create the pages dynamically in C#.
Is there something I did wrong?
Debug Log:
1
True
'sllauncher.exe' (Silverlight): Loaded 'c:\Program Files (x86)\Microsoft Silverlight\4.0.50524.0\en-US\mscorlib.debug.resources.dll'
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in System.Windows.dll
Exception:
Specified argument was out of the range of valid values.
Parameter name: index
RadBookItem randomitem =
new
RadBookItem();
randomitem.Width = 500;
randomitem.Height = 500;
radBook1.Items.Add(randomitem);
Debug.WriteLine(radBook1.Items.Count());
Debug.WriteLine(radBook1.HasItems);
radBook1.Items.RemoveAll();
Debug.WriteLine(radBook1.Items.Count());
Debug.WriteLine(radBook1.HasItems);