MobileForms Toolkit Documentation

Cell.CurrentNode Property

During drawing contains the reference to current node.

protected Node CurrentNode {get;}

Example

The following sample demonstrates the usage in the derived cell (C# only, see also example in AddColumns method of Mapping):

[C#]
      
class ColorTextCell : Resco.Controls.AdvancedTree.TextCell
{
    public ColorTextCell(Resco.Controls.AdvancedTree.TextCell c) : base(c)
    {
    }
    
    // The BackColor and ForeColor of this TextCell are bound
    // to the respective columns in currently drawn node,
    // thus allowing us to change it for every node separately.

    public override Color BackColor
    {
        get
        {
            // take the color from current data, they are set when 
            // drawing the node
            object backColor = CurrentNode["BackColor"];
            if (backColor is Color)            
                return (Color) backColor;
            
            // if using the BoundNode and DataTable, you have to convert
            // it to/from string
            
            return Color.Transparent;
        }
    }
    public override Color ForeColor
    {
        get
        {
            // take the color from current data, they are set when 
            // drawing the node
            object foreColor = CurrentNode["ForeColor"];
            if (foreColor is Color)
                return (Color) foreColor;
            return Color.Transparent;
        }
    }
}
            
    

See Also

Cell Class | Resco.Controls.AdvancedTree Namespace