Exemplo n.º 1
0
        /// <summary>
        /// Overrides the automatic layout behavior of the org chart diagramming control.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The arguments.</param>
        private void OnCustomLayoutItems(object sender, DiagramCustomLayoutItemsEventArgs e)
        {
            if (this.ItemPositions.Count == 0)
            {
                return;
            }

            foreach (var item in e.Items)
            {
                if (item is DiagramContentItem {
                    Content: NamedThingDiagramContentItem namedThingDiagramContentItem
                })
Exemplo n.º 2
0
        /// <summary>
        /// Overrides the automatic layout behavior of the org chart diagramming control.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The arguments.</param>
        private void OnCustomLayoutItems(object sender, DiagramCustomLayoutItemsEventArgs e)
        {
            if (this.ItemPositions.Count == 0)
            {
                return;
            }

            foreach (var item in e.Items)
            {
                if (((DiagramContentItem)item).Content is NamedThingDiagramContentItem namedThingDiagramContentItem)
                {
                    if (this.ItemPositions.TryGetValue(namedThingDiagramContentItem, out var itemPosition))
                    {
                        item.Position = itemPosition;

                        // remove from collection as it is not useful anymore.
                        this.ItemPositions.Remove(namedThingDiagramContentItem);
                    }
                }
            }

            e.Handled = true;
        }