Results 1 to 3 of 3

Thread: Adjusting custom control properties at design time [C# or VB.Net]

  1. #1
    Pup
    Pup is offline
    woof
    Join Date
    Apr 2006
    Location
    West London
    Posts
    265
    Thanks
    18
    Thanked
    19 times in 15 posts
    • Pup's system
      • Motherboard:
      • Asus P8Z68-V Pro
      • CPU:
      • i7-2600K
      • Memory:
      • 8GiB Corsair Vengeance LP DDR3 1600MHz
      • Storage:
      • 2 x 1TB Samsung Spinpoint F3
      • Graphics card(s):
      • 2 x MSI GTX 560 Ti Twin Frozr II 1GiB
      • PSU:
      • Corsair HX850W
      • Case:
      • Antec P182
      • Operating System:
      • Windows 7 Professional x64
      • Monitor(s):
      • HP LP2475w & Iiyama Prolite E435s
      • Internet:
      • Virgin Media 20mb

    Adjusting custom control properties at design time [C# or VB.Net]

    Got a little problem which I'm hoping someone here might know the solution too, I have had a long old look with google and a pretty in-depth book about custom controls and couldn't find what I was after.

    I have a custom control, where changing one property directly affects the value of another. The control works fine at runtime, but for completeness I also want the change to the other property to be reflected in the properties window at design-time, which it currently doesnt do.

    I'm sure it must be something fairly straight-forward, but I just can't find any info on how to do it

  2. #2
    Seething Cauldron of Hatred TheAnimus's Avatar
    Join Date
    Aug 2005
    Posts
    17,164
    Thanks
    803
    Thanked
    2,152 times in 1,408 posts

    Re: Adjusting custom control properties at design time [C# or VB.Net]

    If you've got a higherarchy of properties, and your in effect invalidating one by making a change, have a look at:

    NotifyParentPropertyAttribute Class (System.ComponentModel)
    throw new ArgumentException (String, String, Exception)

  3. #3
    Pup
    Pup is offline
    woof
    Join Date
    Apr 2006
    Location
    West London
    Posts
    265
    Thanks
    18
    Thanked
    19 times in 15 posts
    • Pup's system
      • Motherboard:
      • Asus P8Z68-V Pro
      • CPU:
      • i7-2600K
      • Memory:
      • 8GiB Corsair Vengeance LP DDR3 1600MHz
      • Storage:
      • 2 x 1TB Samsung Spinpoint F3
      • Graphics card(s):
      • 2 x MSI GTX 560 Ti Twin Frozr II 1GiB
      • PSU:
      • Corsair HX850W
      • Case:
      • Antec P182
      • Operating System:
      • Windows 7 Professional x64
      • Monitor(s):
      • HP LP2475w & Iiyama Prolite E435s
      • Internet:
      • Virgin Media 20mb

    Re: Adjusting custom control properties at design time [C# or VB.Net]

    Cheers for the pointer, although what I have are just two base properties.

    I dug a little deeper and knocked up a small test app outside of the control I am working on, and found that there must something specific about the control that I am working on that is giving me this problem, as my test control works fine - change one property and the related one gets changed at design time automatically. I have included the test usercontrol (minus most of the autogenerated usercontrol code) below in case you were wondering what I mean :

    Code:
    using System.ComponentModel;
    
    public partial class RelatedPropertiesC : UserControl
    {
        private bool m_myProp;
    
        [Category("ZTestProps")]
        public bool MyProp
        {
            get { return m_myProp; }
            set
            {
                m_myProp = value;
                this.AutoSize = value; // test if it also changes a standard property
            }
        }
    
        [Category("ZTestProps")]
        public bool InverseMyProp
        {
            get { return !m_myProp; }
            set { m_myProp = !value; }
        }
    }
    So basically I need to figure out what my control is doing different to the norm, to see why the properties aren't automatically changing. So not to worry, for now

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 36
    Last Post: 17-07-2008, 06:24 PM
  2. custom control in flex 2.0
    By manoj_kulkarni in forum Welcome to HEXUS!
    Replies: 0
    Last Post: 17-09-2007, 09:51 AM
  3. ATI Catalyst 5.8 released
    By =TcQi= in forum Graphics Cards
    Replies: 17
    Last Post: 18-08-2005, 12:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •