Ask a questionAsk a question
 

QuestionControlDesigner for WPF custom controls.

  • Friday, April 06, 2007 10:17 AMDoron Ben-David Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Greetings Smile.

     

    I'm working on a custom WPF user control which acts like a button (and surprisingly inherits Button).

    However, my button has some limitations for designtime (The size is constant, the color scheme is

    pre-defined in an enumeration etc..).

    Therefore, I want people who use my control in design time, to be able to do only things I allow.

    In WinForms, I could create myself a MyButtonDesigner : ControlDesigner, and override the

    PostFilterProperties method and there remove unwanted properties (or add/change etc..).

     

    Unfortrantly, I could not find a replacement to the System.Windows.Forms.Design.ControlDesigner

    class for WPF...

    Is there any solution out there?

      

    Code Snippet displaying what I am looking for, written for WinForm ..

     public class MyButtonDesigner : System.Windows.Forms.Design.ControlDesigner
     {
     
      public MyButtonDesigner()
      {
      }

      protected override void PostFilterProperties( IDictionary properties )
      {
       properties.Remove( "ForeColor" );
       properties.Remove( "Size" );
      }
     }

     

    Best Regards,

    Doron. 

All Replies

  • Wednesday, April 11, 2007 8:04 PMDoron Ben-David Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I'll accept also any other solution for treating WPF objects on design time ..

     

    This includes:

    1. Catching and handling events on design enviroment (e.g. VS or Expression Blend).

    2. Overriding design-time properties (as posted on my opening message in this thread).

    3. Adding smart tags (Binding DesignerActionList) to WPFs

    etc..

     

    This whole set of practices (creating custom controls for Avalon/WinFX) seems to be missing...

    I wonder why there is no article for WPF such as this: http://msdn2.microsoft.com/en-us/library/37899azc.aspx

     

     

     

    P.S

    I've posted this thread in microsoft.public.windows.developer.winfx.avalon newsgroup also.

  • Wednesday, May 09, 2007 3:03 PMwpf_Learner Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Even i am looking to use equivalent of ControlDesigner for  my UserControl in WPF.

    Any idea?

     

    Thanks.

  • Wednesday, May 09, 2007 6:52 PMwpf_Learner Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Just findout that "ActivityDesigner" class will do the job.

     

    Thanks.

  • Wednesday, November 19, 2008 10:11 AMMarkito91 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Doron,

    I know it's a pretty old post but did you find a way to do thing you wanted to ??

    I'm currently looking for a way to add smarttag to WPF custom controls...and other thing like those you describe ; any return greatly appreciated !!

    Thanks,


    Marc.