473,804 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Attaching an editor to a property at runtime

Is there some way to attach an editor to a property of a class at runtime ?

Ex.;
public class MyClass
{

[Editor(typeof(I mageEditor),typ eof(UITypeEdito r)]
public int BitmapIndex
{
get {...}
set {...}
}
}

Instead of defining statically before compile time, I need to define the
editor at runtime in order to be used together with the PropertyGrid. Is tha
possible ?

Thanks
Luis A.


Nov 16 '05 #1
2 3033
Luis,

My guess is you need to use ICustomTypeDesc riptor together with your own
class that inherit from PropertyDescrip tor. PropertyDescrip tor's protected
constructor allows you to pass an array of attributes for this property.
This thread might get you started:
http://discuss.develop.com/archives/...S&P=R4310&I=-3

Out of curiosity, why can't you apply attributes at compile time?

HTH,
Alexander

"Luis Arvayo" <am**********@p rodigy.net.mx> wrote in message
news:Oy******** ******@TK2MSFTN GP10.phx.gbl...
Is there some way to attach an editor to a property of a class at runtime
?

Ex.;
public class MyClass
{

[Editor(typeof(I mageEditor),typ eof(UITypeEdito r)]
public int BitmapIndex
{
get {...}
set {...}
}
}

Instead of defining statically before compile time, I need to define the
editor at runtime in order to be used together with the PropertyGrid. Is
tha possible ?

Thanks
Luis A.

Nov 16 '05 #2
Hi,

Thanks for the response and tips.
Out of curiosity, why can't you apply attributes at compile time?
This is a class which the developer (this is a tool for developers) could
want to add its own property editor in order to use together with
PropertyGrid, and I don't want to define a fixed editor. That is to say, the
point here is the customization of the editor, instead of a fixed one.

I know that in order to use the PropertyGrid with custom editors, an wrapper
could be used for this class but that will be much more work.

Thanks
Luis A.
"Alexander Shirshov" <al*******@omni talented.com> escribió en el mensaje
news:%2******** **********@TK2M SFTNGP09.phx.gb l... Luis,

My guess is you need to use ICustomTypeDesc riptor together with your own
class that inherit from PropertyDescrip tor. PropertyDescrip tor's protected
constructor allows you to pass an array of attributes for this property.
This thread might get you started:
http://discuss.develop.com/archives/...S&P=R4310&I=-3

Out of curiosity, why can't you apply attributes at compile time?

HTH,
Alexander

"Luis Arvayo" <am**********@p rodigy.net.mx> wrote in message
news:Oy******** ******@TK2MSFTN GP10.phx.gbl...
Is there some way to attach an editor to a property of a class at runtime
?

Ex.;
public class MyClass
{

[Editor(typeof(I mageEditor),typ eof(UITypeEdito r)]
public int BitmapIndex
{
get {...}
set {...}
}
}

Instead of defining statically before compile time, I need to define the
editor at runtime in order to be used together with the PropertyGrid. Is
tha possible ?

Thanks
Luis A.


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2402
by: m. pollack. | last post by:
Hi all, Is there any information to be had about the "Object Collection Editor" that appears when you click on a collection property in the PropertyGrid control? I have a class that maintains a collection of instances of the same class, and I would like the user to be able to expand the nested instances and view their properties. For example, if I have a class called TestClass that has
0
1864
by: Dave | last post by:
Hi everyone, (I already posted this to the VS.NET IDE news group without any responses, so I'm attempting one more time in this group) The issue I'm having is occuring in the IDE of VS.NET 2003, although I'm not sure what is actually causing the problem. I can't summarize the issue, so please read on to find out more. I've created a BaseDialogEditor class that allows a developer (namely me) to create Modal editors for controls at...
1
4720
by: Mark Kamoski | last post by:
Hi-- All of sudden (?) the VS.NET v1 IDE is NOT automatically attaching aspnet_wp.exe as a debugged process. Why? Here is the situation. VS.NET (v1)
3
4321
by: Shimon Sim | last post by:
I have control. One of the properties is implemented as StringCollection. I didn't use any Editor attribute for it. During Design time system shows dialog similar to Items in DropDownList but Add button throws an error "Constructor on type System.String not found.". I may understand this message - there are too many contractor and non of them takes string. But how can I fix the problem or may be use the editor similar to Font.Names...
4
2542
by: Michael | last post by:
Dear all .. If I want to use develop a user control and declare a public property which the type is System.Windows.Forms.GridTableStylesCollection For example : Public Class LookAndView Inherits System.Windows.Forms.UserControl Private _Collection As GridTableStylesCollection
0
1298
by: Olivier Ishacian | last post by:
XMLmind XML Editor V3.0 Patch 1 can be downloaded from http://www.xmlmind.com/xmleditor/download.shtml _____________________________________________ V3.0 Patch 1 (December 2, 2005) Enhancements: ~~~~~~~~~~~~~
0
893
by: john | last post by:
Hi, I have a simple VB .NET application using SQL Express and datasets. The connection string for my datasets is pointing to my development location. At runtime I change the connection string property in the tableadapters to point to the correct runtime database. This worked fine until I deployed my app to another machine. Now when the app tried to fill my datasets it gives errors saying that the database can't be attached as it...
2
2320
by: ARC | last post by:
(sorry for the re-post, but I thought I would put the winmail.dat where it's visible in the subject...thanks!) Hello all, I have a question that I hope someone can help with. I have an Access 97 App, and I allow the user 2 options for e-mailing: MSMapi and MS Outlook 2000/XP. I have a user who is having trouble with the MS Outlook option. He wanted to use this so he could attach quotes as a .pdf instead, which I have built an...
2
4226
by: R.A.F. | last post by:
Hi, I have a custom control in which i have a collection property named "Columns". this collection property add/remove column objects. in my Column class i have a property named Alignment which use a custom property editor. when this property editor is not linked to this property,
0
9714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10600
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10096
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9174
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7638
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5534
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3834
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.