locked
WPF Design Time Toolbar items RRS feed

  • Question

  • Hello everybody,

    I would like to know how can I have a toolbar with some default buttons that show up in design time also. Basically I want a reusable ToolBar with some default buttons on it. I add my default buttons in codebehind to the items collection of my custom toolbar derived from the default toolbar, however I can see them only at runtime. In design time these elements are not appearing on the ToolBarPanel of the control.
    If this is not possible could anyone suggest an alernative in order to preserve the basic toolbar functionality also?

    Thanks,
    Ervin
    • Moved by Marco Zhou Wednesday, June 18, 2008 6:53 AM Cider issue
    Monday, June 16, 2008 10:33 AM

Answers

  •  The recommended approach would be to use the WPF Designer Extensibility to add these default items to your toolbar control.

    That way you could either use a DefaultInitializer to always add the items when the control gets created or you could create a MenuAction "Insert Standard Items" as in Windows Forms, which would then appear in the designer's context menu when your toolbar control is selected.

    Jim's blog has a lot of helpful information around our designer extensibility too.
    Marco Goertz \ Sr. Dev Lead \ WPF Designer "Cider" \ Microsoft
    • Marked as answer by Mark Boulter Tuesday, July 1, 2008 4:24 PM
    • Marked as answer by Mark Boulter Tuesday, July 1, 2008 4:24 PM
    Wednesday, June 18, 2008 2:35 PM

All replies

  • I moved this thread from WPF forum to Cider forum for better answers.

    Thanks
    Wednesday, June 18, 2008 6:54 AM
  •  The recommended approach would be to use the WPF Designer Extensibility to add these default items to your toolbar control.

    That way you could either use a DefaultInitializer to always add the items when the control gets created or you could create a MenuAction "Insert Standard Items" as in Windows Forms, which would then appear in the designer's context menu when your toolbar control is selected.

    Jim's blog has a lot of helpful information around our designer extensibility too.
    Marco Goertz \ Sr. Dev Lead \ WPF Designer "Cider" \ Microsoft
    • Marked as answer by Mark Boulter Tuesday, July 1, 2008 4:24 PM
    • Marked as answer by Mark Boulter Tuesday, July 1, 2008 4:24 PM
    Wednesday, June 18, 2008 2:35 PM