If I designed with RadDiagramShape, I can Add/Remove RadDiagramShape in RadDiagram, though.
How can I Visible or Hidden Children nodes in RadDiagram when Node were clicked?
I made some source code for diagram like this:
public class NodeBase : HierarchicalNodeViewModel
{
private long id;
public long Id
{
get { return id; }
set
{
if (id != value)
{
id = value;
this.OnPropertyChanged("Id");
}
}
}
...(Omit)...
}
public class LinkBase : LinkViewModelBase<HierarchicalNodeViewModel>
{
private eLinkTypes linkType;
public eLinkTypes LinkType
{
get { return linkType; }
set
{
if (linkType != value)
{
linkType = value;
this.OnPropertyChanged("LinkType");
}
}
}
...(Omit)...
}
public class FlowChartManager : ObservableGraphSourceBase<NodeBase , LinkBase>
{
public FlowChartManager()
{
PopulateGraphSource();
}
public FlowChartManager PopulateGraphSource()
{
//Add Nodes
NodeBase processNode1 = new NodeBase ()
{
Position = new Point(10, 10),
Content = "Process 1",
}; base.InternalItems.Add(processNode1);
NodeBase processNode2_1 = new NodeBase ()
{
Position = new Point(100, 100),
Content = "Process 2-1",
};
NodeBase processNode2 = new NodeBase ()
{
Position = new Point(100, 100),
Content = "Process 2",
};processNode2 .Children.Add(processNode2_1);
base.InternalItems.Add(processNode2);
NodeBase processNode3 = new NodeBase ()
{
Position = new Point(200, 200),
Content = "Process 3",
}; base.InternalItems.Add(processNode3);
//Add Links
base.InternalLinks.Add(new LinkBase(processNode1, processNode2) { LinkType = eLinkTypes.None, TargetCapType = Telerik.Windows.Diagrams.Core.CapType.Arrow1Filled });
}