![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Setting properties on hosted toolstrip control at design time I created my own toolstrip control using ToolStripControlHost. When I add this to a toolstrip, I want to adjust the properties of the hosted control in the designer but they always get reset when I compile. Can anyone tell me how to fix this? This should be similar to accessing the panels in a SplitContainer control so I think it is possible. Here is some *sample* code to illustrate the problem. [ToolStripItemDesignerAvailability (ToolStripItemDesignerAvailability.ToolStrip | ToolStripItemDesignerAvailability.StatusStrip)] public class ToolStripHostExample : ToolStripControlHost { public TextBox MyControl { get { return (TextBox)Control; } } public ToolStripHostExample() : base(new TextBox()) { } } Add it to a toolstrip and try to set the MyControl.ReadOnly attribute to true in the designer. When you compile, the property will be reset to false. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Setting properties on hosted toolstrip control at design time For anyone else struggling with a similar problem, I found the solution by taking a closer look at the panels in theSplitContainer control. Adding the DesignerSerializationVisibility attribute to the MyControl property in my sample code solves the problem. Here is the fixed sample code... [ToolStripItemDesignerAvailability (ToolStripItemDesignerAvailability.ToolStrip | ToolStripItemDesignerAvailability.StatusStrip)] public class ToolStripHostExample : ToolStripControlHost { [DesignerSerializationVisibility (DesignerSerializationVisibility.Content)] public TextBox MyControl { get { return (TextBox)Control; } } public ToolStripHostExample() : base(new TextBox()) { } } On Jul 30, 4:48*pm, Mike <MLM...@xxxxxx> wrote: Quote: > I created my own toolstrip control using ToolStripControlHost. When I > add this to a toolstrip, I want to adjust the properties of the hosted > control in the designer but they always get reset when I compile. Can > anyone tell me how to fix this? This should be similar to accessing > the panels in a SplitContainer control so I think it is possible. > > Here is some *sample* code to illustrate the problem. > > [ToolStripItemDesignerAvailability > (ToolStripItemDesignerAvailability.ToolStrip | > ToolStripItemDesignerAvailability.StatusStrip)] > public class ToolStripHostExample : ToolStripControlHost > { > * public TextBox MyControl > * { > * * get { return (TextBox)Control; } > * } > > * public ToolStripHostExample() : base(new TextBox()) > * { > * } > > } > > Add it to a toolstrip and try to set the MyControl.ReadOnly attribute > to true in the designer. When you compile, the property will be reset > to false. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Can't read appSettings of IE hosted control when under SSL | .NET General | |||
| Security questions around browser hosted control interaction. | .NET General | |||
| Re: Problem running .NET user control hosted on Windows Vista / IE 7 | Vista security | |||
| Problem running .NET user control hosted on Windows Vista / IE 7 | Vista security | |||