Pergunta

Good morning, I have a problem I could not fix, I need you in the line of an object "TreeListNode" can display a text in three lines, the problem is that I can only see the first line of this text the two remaining lines are lost even enlarging the height of the row are not.

I tried to wrap property setar as follows.

tln.TreeList.Appearance.Row.TextOptions.WordWrap = WordWrap.Wrap;

tnl is an object where "TreeListNode", but this way I can not see the 3 lines of my string.

I've also tried doing this.

tln.TreeList.OptionsBehavior.AutoNodeHeight = true;

achievement but also display all lines of my text string.

The format of my text string is as follows.

text text text text \r\n text text text \r\n text text text text text text.

thanks

Foi útil?

Solução

I found the answer here. You need to set the editor for the cell to be of type RepositoryItemMemoEdit.

Example code (windows form project):

    protected override void OnLoad(EventArgs e)
    {
        CreateColumns(treeList1);
        CreateNodes(treeList1);

        treeList1.Appearance.Row.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
        treeList1.OptionsBehavior.AutoNodeHeight = true;

        base.OnLoad(e);
    }

    private void CreateColumns(TreeList tl)
    {
        // Create three columns.
        tl.BeginUpdate();
        tl.Columns.Add();
        tl.Columns[0].Caption = "Customer";
        tl.Columns[0].VisibleIndex = 0;
        tl.Columns.Add();
        tl.Columns[1].Caption = "Location";
        tl.Columns[1].VisibleIndex = 1;
        tl.Columns.Add();
        tl.Columns[2].Caption = "Phone";
        tl.Columns[2].VisibleIndex = 2;
        tl.Columns[0].ColumnEdit = new DevExpress.XtraEditors.Repository.RepositoryItemMemoEdit();
        tl.EndUpdate();
    }

    private void CreateNodes(TreeList tl)
    {
        tl.BeginUnboundLoad();
        // Create a root node .
        TreeListNode parentForRootNodes = null;
        TreeListNode rootNode = tl.AppendNode(
            new object[] { "Alfreds FutterkisteTEST\r\nTEST\r\nTEST", "Germany, Obere Str. 57", "030-0074321" },
            parentForRootNodes);            

        // Create a child of the rootNode
        tl.AppendNode(new object[] { "Suyama, Michael", "Obere Str. 55", "030-0074263" }, rootNode);
        // Creating more nodes
        // ...
        tl.EndUnboundLoad();
    }
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top