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

"Cannot modify the Items collection when the GraphSource is set"

1 Answer 116 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Kristoffer
Top achievements
Rank 1
Kristoffer asked on 20 Dec 2012, 03:57 PM

Hi,

<RadDiagram ...>
<primitives:GraphPaper />
</RadDiagram ...>

That tag causes an exception to be thrown:

A first chance exception of type 'System.InvalidOperationException' occurred in Telerik.Windows.Controls.Diagrams.dll

Additional information: Cannot modify the Items collection when the GraphSource is set.

What's up?

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 21 Dec 2012, 07:32 AM
Hi Kristoffer,

 The GraphPaper should not be used as a "child" element of the RadDiagram. In a typical ItemsControl, when something is added as a child in XAML, it is wrapped to the corresponding Container. If you use ListBox, the added object will be wrapped to ListBoxItem, for instance. Analogically, RadDiagram will wrap the object to RadDiagramShape. But you can never have both bound items generated via ItemsSource and a static ones in XAML. The analogical system exception in a System Control will be:
"Cannot modify the Items collection when the DataSource is set" (or something very similar).
On the other hand, do you really need to use the GraphPaper stand alone ? Actually you can set it with a single property - IsBackGroundSurfaceVisible. You can find more info here.

Kind regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Diagram
Asked by
Kristoffer
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or