Custom Commands on Dynamically Loaded RadDocks

4 posts, 0 answers
  1. Eric Hsu
    Eric Hsu avatar
    1 posts
    Member since:
    Dec 2006

    Posted 27 Apr 2007 Link to this post

    I'm adding RadDocks to my page dynamically, and I need to add a custom command to the toolbar.  There are 2 issues I'm having with this:

        1. Is there  a way to change the icon for my custom command?

        2. Once I add a custom command, the default commands are lost.  I need to have the close and minimize buttons on my control, how can I get these back?

    Thanks.
  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 02 May 2007 Link to this post

    Hi Eric,

    1) To change the icon of the custom command you need to define a CSS style on your page and then set the CssClass property of your custom command. Something like this:
    .MyCustomStyle
    {
        width:15px;
        background:url(images/custom.gif) repeat-x;
    }
    ...
    DockCommand command = new DockCommand();
    command.CssClass = "MyCustomStyle";
    RadDock1.Commands.Add(command);

    The DockToggleCommand has two properties: CssClass and AlternateCssClass for the two states of the command item.

    2) By default RadDock will automatically add command items in its Commands collection, if its value was not changed, depending on the value of the DefaultCommands property. When you add a command item in the code behind, or in the ASPX/ASCX, RadDock will not create the default command items. You need to add them explicitly:
    DockCommand command = new DockCommand();
    command.CssClass = "MyCustomStyle";
    RadDock1.Commands.Add(command);
    RadDock1.Commands.Add(new DockCloseCommand());
    RadDock1.Commands.Add(new DockExpandCollapseCommand());
    RadDock1.Commands.Add(new DockPinUnpinCommand());

    All the best,
    Valeri Hristov (Senior Developer, MCSD)
    the telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. madhu
    madhu avatar
    29 posts
    Member since:
    Mar 2007

    Posted 18 Jul 2007 Link to this post

    Hi

    I tried to create custom command as shown but custom command does now show with RadDock.

    Any Help?

    Thanks.
  4. Petya
    Admin
    Petya avatar
    869 posts

    Posted 19 Jul 2007 Link to this post

    Hi madhu,

    I am attaching a simple page demonstrating how to add dock dynamically with a custom command with its own icon plus a movie demonstrating that everything works just fine. If you continue to experience the same problem, then please, send us a simple running page that reproduces the issue and we will work on it.

    Best wishes,
    Petya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top