IsReadOnly Xaml Tag Diagram

Dear Support,

For some reason we can not get the isReadOnly Xaml tag working in a binding expression or without a binding expression in silverlight ( for simplicity we have removed other Xaml properties set on the diagram ).

<go:Diagram x:Name=“myDiagram” DataContext="{StaticResource OpBouwNetstrucViewModelViewSource}“
IsReadOnly=”{Binding Path=DiagramIsReadOnly}"

A soon as we ad the property either True or false the diagram does not fire the the Selection deleting event that is set as follows:

RemoveHandler myDiagram.SelectionDeleting, AddressOf myDiagram_SelectionDeleting
AddHandler myDiagram.SelectionDeleting, AddressOf myDiagram_SelectionDeleting

We have tried removing the binding and setting the property to false or true but get the same behavior.

The only way we get this working is in code behind by calling:

myDiagram.IsReadOnly = False

Are we missing something?


Well, if you set or bind Diagram.IsReadOnly to true, it would make sense that the Diagram.SelectionDeleting event never happens, because it shouldn’t – the Delete command is disabled when Diagram.IsReadOnly is true.

But I do not see why you are having trouble binding Diagram.IsReadOnly. If you do have it bound, does the debugger show that it actually has the same value as the bound data property?

That is correct it should not fire when set to true but when set to false it does not fire either, only when we remove the property from xaml entirely does the event fire again. So in other words, if we set IsReadOnly = “False” in Xaml the event does not fire wereas we expect it to fire.

I just tried setting IsReadOnly=“False” on a <go.Diagram> and found that it worked as expected, including raising the Diagram.SelectionDeletingEvent and Diagram.SelectionDeletedEvent.

Can you check the value of Diagram.IsReadOnly to make sure it is still false when the user tries to delete the selection?

OK then it must be something else in our code since the IsReadOnly is True when the user tries to delete, we’ll look further to see what is causing this. Thanks