J
jc
I have a conundrum I'm hoping someone here might have an idea for:
I am implementing a propertygrid on a form that is "bound" to a business
object class containing global settings that a user will edit using the
property grid.
So far so good, works just fine etc etc.
One of the properties is a string that requires a separate dialog box to
edit it.
No problem normally: I can just use a custom UI Type editor, however, I
don't think I can because the class with the property being edited is in a
business object layer assembly that knows nothing about Windows Forms, it's
got no UI code whatsoever and is used for both the web and winform version
of the app.
I can't put the UIEditor code in the business object layer as that would
create a dependancy on windows forms.
I can't put the UIEditor code in the Winform UI layer assembly because I
would then need to reference it in the Editor attribute of the property in
the business object which would create a dependancy on the UI Layer which I
can't have obviously.
My only potential solution I can think of is to duplicate the business
objects properties in a "middle-man" object in the UI and copy back and
forth as it's edited, but this seems really clunky and will result in two
separate classes that need to be kept in sync during development rather than
the nice neat single one now.
I can't find any way of setting the editor at runtime and attributes can't
be changed at runtime so that avenue seems to be out as well.
Is there any way to accomplish this?
Any ideas would be gratefully appreciated.
I am implementing a propertygrid on a form that is "bound" to a business
object class containing global settings that a user will edit using the
property grid.
So far so good, works just fine etc etc.
One of the properties is a string that requires a separate dialog box to
edit it.
No problem normally: I can just use a custom UI Type editor, however, I
don't think I can because the class with the property being edited is in a
business object layer assembly that knows nothing about Windows Forms, it's
got no UI code whatsoever and is used for both the web and winform version
of the app.
I can't put the UIEditor code in the business object layer as that would
create a dependancy on windows forms.
I can't put the UIEditor code in the Winform UI layer assembly because I
would then need to reference it in the Editor attribute of the property in
the business object which would create a dependancy on the UI Layer which I
can't have obviously.
My only potential solution I can think of is to duplicate the business
objects properties in a "middle-man" object in the UI and copy back and
forth as it's edited, but this seems really clunky and will result in two
separate classes that need to be kept in sync during development rather than
the nice neat single one now.
I can't find any way of setting the editor at runtime and attributes can't
be changed at runtime so that avenue seems to be out as well.
Is there any way to accomplish this?
Any ideas would be gratefully appreciated.