private async void GraphSourceWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            graphSource = ((AdjacentEdgesGraphSource)Application.Current.MainWindow.Resources["GraphSource"]);

            // always show focus indicator
            graphControl.FocusIndicatorManager.ShowFocusPolicy = ShowFocusPolicy.Always;

            graphSource.EdgeDefaults.Labels.LayoutParameter = new FreeEdgeLabelModel().CreateDefaultParameter();

            // use custom PolylineEdgeStyleRenderer wrapper that switches the edge color
            // based on the attached business data
            graphSource.EdgeDefaults.Style = new PolylineEdgeStyle(new MyPolylineEdgeStyleRenderer(graphSource));

            // create inital business data
            CreateSampleData();

            await ApplyLayout(false);
        }
Ejemplo n.º 2
0
        public AddConnectionDialog(AdjacentEdgesGraphSource graphSource, CreationMode mode)
        {
            InitializeComponent();

            this.mode = mode;
            ApplyMode();

            dataItems = new List <EntityData>();
            // fill data items list with all the nodes available in the graph
            foreach (var node in graphSource.Graph.Nodes)
            {
                EntityData data = graphSource.GetBusinessObject(node) as EntityData;
                if (data != null)
                {
                    dataItems.Add(data);
                }
            }
            targetCombobox.SelectionChanged += TargetComboboxOnSelectionChanged;
            targetCombobox.ItemsSource       = dataItems;
            targetCombobox.SelectedIndex     = 0;
        }
 public MyPolylineEdgeStyleRenderer([NotNull] AdjacentEdgesGraphSource graphSource)
 {
     this.graphSource = graphSource;
 }