Nevron Forum

Want to add custom control into dockingcommandbar

https://www.nevron.com/Forum/Topic3077.aspx

By JSW W. - Monday, February 15, 2010

There are two control by default available, combobox and button for dockingcommandbar.

Are there way to insert other controls? If possible how to referent to it.

Thanks,

By Angel Chorbadzhiev - Monday, February 15, 2010

Hello JSW W.,

You can subclass the NControlHostCommand class and in the constructor should create the desired control and call SetControl(control) method.

Here is an example how can create such a command that hosts a text box control:

public class NTextBoxCommand : NControlHostCommand

{

    public NTextBoxCommand()

    {

        NTextBox tb = new NTextBox();

        tb.Size = new Size(PrefferedWidth, PrefferedHeight);

        SetControl(tb);

    }

}

Then you need to create an instance of this class and add it to the toolbars Commands collection.

Regards,

Angel.

By JSW W. - Wednesday, February 17, 2010

hello almost there
Can you give me the trick to change order of the buttons? commands.add() listed my control on the right most.
Thanks,
By JSW W. - Wednesday, February 17, 2010

i use insert and all is well. Cheers