How do you customize C1TreeView adorners?

Posted by: jacob.a.buchanan6.ctr on 16 June 2023, 7:58 am EST

    • Post Options:
    • Link

    Posted 16 June 2023, 7:58 am EST

    The documentation mentions that you can set the DragDropArrowMarker and DragDropLineMarker properties, but both of these properties are readonly. I would like to be able to customize the color and style of the adorners to fit my project’s theme. How can I customize these properties?

    C1 adorner documentation: https://www.grapecity.com/componentone/docs/wpf/online-basiclibrary/Drag-and-Drop-Nodes.html

  • Posted 19 June 2023, 4:54 am EST

    Hi Jacob,

    >The documentation mentions that you can set the DragDropArrowMarker and DragDropLineMarker properties, but both of these properties are readonly.

    We apologize for any confusion caused. It appears that there was a mistake in the documentation. The DragDropArrowMarker and DragDropLineMarker properties mentioned in the documentation are actually read-only, meaning they cannot be directly modified or set.

    However, you can achieve the desired customization of the DragDropArrowMarker and DragDropLineMarker by handling the Loaded event of the C1TreeView control. In the event handler, you can access the elements of the DragDropArrowMarker and DragDropLineMarker and modify their properties accordingly.

    Here’s an example of how you can accomplish this:

    treeView.Loaded += (s, e) =>
    {
        var tree = s as C1TreeView;
        var arrow = (tree.DragDropArrowMarker as Grid).Children[0] as Path;
        arrow.Fill = Brushes.Green;
        var line = (tree.DragDropLineMarker as Grid).Children;
        foreach (Path item in line)
        {
            if (item != null)
            {
                item.Fill = Brushes.Red;
                item.Stroke = Brushes.Red;
            }
        }
    };

    Kindly refer to the attached sample for full implementation. See TreeViewDragDrop.zip

    Thanks & Regards,

    Aastha

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels