Click here to Skip to main content
15,916,693 members
Home / Discussions / C#
   

C#

 
GeneralNetwork in C#: how to detect that I have a break connection Pin
youssef20-Oct-04 12:24
youssef20-Oct-04 12:24 
GeneralRe: Network in C#: how to detect that I have a break connection Pin
Heath Stewart20-Oct-04 16:36
protectorHeath Stewart20-Oct-04 16:36 
QuestionRegional parameters : how to change the langage of the system ? Pin
youssef20-Oct-04 12:24
youssef20-Oct-04 12:24 
AnswerRe: Regional parameters : how to change the langage of the system ? Pin
Nick Parker20-Oct-04 16:51
protectorNick Parker20-Oct-04 16:51 
GeneralVery Simple question Pin
ben220-Oct-04 11:52
ben220-Oct-04 11:52 
GeneralRe: Very Simple question Pin
Dave Kreskowiak20-Oct-04 12:24
mveDave Kreskowiak20-Oct-04 12:24 
GeneralUser Control Arrow Keys Not Being detected Pin
R2B220-Oct-04 11:22
R2B220-Oct-04 11:22 
GeneralProblem with designer and custom UI editor Pin
object8820-Oct-04 9:52
object8820-Oct-04 9:52 
OK, I have a control, Foo. This class has an object, FooOptions, as a property (named Options). On FooOptions there is a integer property, Number.

I want to make FooOptions editable from the designer, when a Foo control is planted on a form. In particular, I want to pop up a dialog box when the user double-clicks on Options. So I wrote a form, FooOptionsUIEditor, which holds a PropertyGrid (which gets an instance of FooOptions), and gets launched from FooOptionsEditor, which is derived from UITypeEditor. I set the Editor attribute on the Foo.Options property. I also wrote FooOptionsSerializer, which is devired from CodeDomSerializer, and used that for FooOptions's DesignerSerializer attribute. Finally, on Foo.Options, I set the DesignerSerializationVisibility attribute to Content.

What this should do, I expect, is give me a form when I double click on Options in the designer, where I can edit Number. When I close the dialog, it should mark the parent form (which holds an instance of Foo) as editted, and allow me to Save, which would trigger the serializer and place some code in the Windows Forms Designer generated code area on said parent form.

And in fact, everything works-- except that the parent form is not getting marked as editted. My Foo.ShouldSerializeOptions() method is getting called (a lot), and I'm returning true. If I change some other property, either on Foo or on the parent form containing Foo, then the parent form is marked as editted, and I can save, and my serializer works perfectly. My changes are lost if I just edit the FooOptions and close the form in the designer. However, if I edit the FooOptions twice from the designer, the first changes show up, so it's persisted in memory alright.

I thought that maybe there was some trouble with the fact that I was editting FooOptions in a modal form, so I rewrote it to edit with a drop-down. That didn't work. I tested a drop-down with a simple string property on Foo, and that worked. So then I tested a simple string property on Foo, editted with a form, and that worked to. I have to conclude that the fact that FooOptions is an object is causing some kind of trouble.

Incidently, on Foo, Options only has a getter, no setter. But if I add a setter, the behavior doesn't seem to change.

How do I get the parent form to be marked as editted?

This is the first time I've worked with designers and customizing designer behavior, so please, any tips are welcome, no matter how simple. I've been banging my head against the wall for 3 days now. Frown | :(

GeneralRe: Problem with designer and custom UI editor Pin
Heath Stewart20-Oct-04 10:12
protectorHeath Stewart20-Oct-04 10:12 
GeneralRe: Problem with designer and custom UI editor Pin
object8820-Oct-04 10:35
object8820-Oct-04 10:35 
GeneralRe: Problem with designer and custom UI editor Pin
object8820-Oct-04 11:07
object8820-Oct-04 11:07 
GeneralRe: Problem with designer and custom UI editor Pin
Heath Stewart20-Oct-04 13:33
protectorHeath Stewart20-Oct-04 13:33 
GeneralRe: Problem with designer and custom UI editor Pin
Heath Stewart20-Oct-04 13:34
protectorHeath Stewart20-Oct-04 13:34 
GeneralConfigurationSettings.AppSettings Pin
Guillermo Jimenez20-Oct-04 5:50
Guillermo Jimenez20-Oct-04 5:50 
GeneralRe: ConfigurationSettings.AppSettings Pin
Guillermo Jimenez20-Oct-04 5:51
Guillermo Jimenez20-Oct-04 5:51 
GeneralRe: ConfigurationSettings.AppSettings Pin
Heath Stewart20-Oct-04 6:18
protectorHeath Stewart20-Oct-04 6:18 
GeneralGDI+ drawing onto picturebox Pin
xiaowenjie20-Oct-04 5:39
xiaowenjie20-Oct-04 5:39 
GeneralRe: GDI+ drawing onto picturebox Pin
Heath Stewart20-Oct-04 6:50
protectorHeath Stewart20-Oct-04 6:50 
GeneralRe: GDI+ drawing onto picturebox Pin
xiaowenjie20-Oct-04 7:47
xiaowenjie20-Oct-04 7:47 
GeneralRe: GDI+ drawing onto picturebox Pin
Not Active20-Oct-04 10:16
mentorNot Active20-Oct-04 10:16 
GeneralRe: GDI+ drawing onto picturebox Pin
McClamm20-Oct-04 7:03
McClamm20-Oct-04 7:03 
GeneralRe: GDI+ drawing onto picturebox Pin
xiaowenjie20-Oct-04 7:49
xiaowenjie20-Oct-04 7:49 
GeneralRe: GDI+ drawing onto picturebox Pin
Heath Stewart20-Oct-04 9:51
protectorHeath Stewart20-Oct-04 9:51 
Generalderivation question Pin
3Dizard20-Oct-04 5:33
3Dizard20-Oct-04 5:33 
GeneralRe: derivation question Pin
Heath Stewart20-Oct-04 6:32
protectorHeath Stewart20-Oct-04 6:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.