I have created dynamic validation on scheme editing. But I encountered with few problems.
1) How to get active connection correctly? I use method described below:
01.
private
RadDiagramConnection GetActiveConnection()
02.
{
03.
var toolService = ServiceLocator.GetService<IToolService>();
04.
if
(toolService ==
null
|| toolService.ActiveTool ==
null
)
return
null
;
05.
06.
var toolType = toolService.ActiveTool.GetType();
07.
var fieldInfo = toolType.GetField(
"activeConnection"
, BindingFlags.Instance | BindingFlags.NonPublic);
08.
if
(fieldInfo ==
null
)
return
null
;
09.
return
fieldInfo.GetValue(toolService.ActiveTool)
as
RadDiagramConnection;
10.
}
3) Please, make RadDiagramShapeBase.UpdateVisualStates() non internal.