Infragistics2.Win.UltraWinTree.v8.1
AllowCopy Property
See Also  Example
Infragistics.Win.UltraWinTree Namespace > Override Class : AllowCopy Property

Gets/sets a value which determines if a user can copy the UltraTree.SelectedNodes to the clipboard.

Syntax

Visual Basic (Declaration) 
Public Property AllowCopy As DefaultableBoolean
C# 
public DefaultableBoolean AllowCopy {get; set;}

Remarks

When true, if the user pressed the "Ctrl+C" or "Shift+Insert" key combinations while the UltraTree has focus, the tree will automatically copy the selected nodes to the clipboard.

Example

The following sample code shows how to allow clipboard cut/copy/paste operations for nodes.

Visual BasicCopy Code
    Imports Infragistics.Win
    Imports Infragistics.Win.UltraWinTree

    Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click

        ' Note: the Override objects are exposed as properties off
        ' the tree, the node and the nodes collection as well as
        ' items in the NodeLevelOverrides collection. This allows
        ' default settings to be specified for the tree, a node,
        ' a node's children or for a level in the tree.

        ' Set the default to allow clipboard operations
        Me.ultraTree1.Override.AllowCut = DefaultableBoolean.True
        Me.ultraTree1.Override.AllowCopy = DefaultableBoolean.True
        Me.ultraTree1.Override.AllowPaste = DefaultableBoolean.True

        ' Set the default for nodes that are at level 2
        ' (i.e. grandchild nodes of root modes) so that
        ' they can't be cut or copied.
        ' This overrides the default setting above.
        Me.ultraTree1.NodeLevelOverrides(2).AllowCut = DefaultableBoolean.False
        Me.ultraTree1.NodeLevelOverrides(2).AllowCopy = DefaultableBoolean.False

        ' Set the default for nodes at the root level
        ' so that they can't be pasted.
        ' This overrides the default settings above.
        Me.ultraTree1.Nodes.Override.AllowPaste = DefaultableBoolean.False

        ' Get a specific node by its key value.
        ' Note: this will return the node that has that key
        ' from anywhere in the tree structure since keys are
        ' unique across the entire tree.
        Dim node As UltraTreeNode = Me.ultraTree1.GetNodeByKey("child node 1")

        If Not node Is Nothing Then
            ' Disallow cuttin of that specific node only.
            ' This overrides any default settings above.
            node.Override.AllowCut = DefaultableBoolean.False

            ' However, do allow cutting of that node's child nodes
            node.Nodes.Override.AllowCut = DefaultableBoolean.True
        End If

    End Sub

C#Copy Code
       using System.Diagnostics;
       
using Infragistics.Win;
       
using Infragistics.Win.UltraWinTree;

       
private void button1_Click(object sender, System.EventArgs e)
       {
           
// Note: the Override objects are exposed as properties off
           
// the tree, the node and the nodes collection as well as
           
// items in the NodeLevelOverrides collection. This allows
           
// default settings to be specified for the tree, a node,
           
// a node's children or for a level in the tree.
 
           
// Set the default to allow clipboard operations
           
this.ultraTree1.Override.AllowCut = DefaultableBoolean.True;
           
this.ultraTree1.Override.AllowCopy = DefaultableBoolean.True;
           
this.ultraTree1.Override.AllowPaste = DefaultableBoolean.True;
       
           
// Set the default for nodes that are at level 2
           
// (i.e. grandchild nodes of root modes) so that
           
// they can't be cut or copied.
           
// This overrides the default setting above.
           
this.ultraTree1.NodeLevelOverrides[2].AllowCut = DefaultableBoolean.False;
           
this.ultraTree1.NodeLevelOverrides[2].AllowCopy = DefaultableBoolean.False;

           
// Set the default for nodes at the root level
           
// so that they can't be pasted.
           
// This overrides the default settings above.
           
this.ultraTree1.Nodes.Override.AllowPaste = DefaultableBoolean.False;

           
// Get a specific node by its key value.
           
// Note: this will return the node that has that key
           
// from anywhere in the tree structure since keys are
           
// unique across the entire tree.
           
UltraTreeNode node = this.ultraTree1.GetNodeByKey("child node 1");

           
// Disallow cuttin of that specific node only.
           
// This overrides any default settings above.
           
node.Override.AllowCut = DefaultableBoolean.False;

           
// However, do allow cutting of that node's child nodes
           
node.Nodes.Override.AllowCut = DefaultableBoolean.True;
       
       }

See Also