Hello:
I've seen code in some books for databinding that handles attaching Attributes
to
Properties during runtime...which is very close (but no cigar) to what I am
looking for...
The code in the book was basically the following:
override protected void PreFilterProper ties(IDictionar y properties) {
base.PreFilterP roperties(prope rties);
PropertyDescrip tor prop = (PropertyDescri ptor)properties["DataSource "];
if(prop!=null) {
System.Componen tModel.Attribut eCollection runtimeAttribut es =
prop.Attributes ;
// make a copy of the original attributes but make room for one extra
attribute
//ie the TypeConverter attribute
Attribute[] attrs = new Attribute[runtimeAttribut es.Count + 1];
runtimeAttribut es.CopyTo(attrs , 0);
attrs[runtimeAttribut es.Count] = new
TypeConverterAt tribute(typeof( DataSourceConve rter));
prop = TypeDescriptor. CreateProperty( this.GetType(), "DataSource ",
typeof(string), attrs);
properties["DataSource "] = prop;
}...
Although this is not what I want -- it intrigues me, because one of the things I
wish to do is change the Designer attribute on a Control on the fly --
specifically, to change a Control's ControlDesigner attribute from standard
ControlDesigner to ReadWriteDesign er --- and back again -- to get around the
limitations that are in the IDE...
Only problem is that I don't see anywhere in the Framwork where to SET
attributes... I can read them, and can append to them as above snippet shows:
System.Componen tModel.Attribut eCollection attrsExist = o.GetType().Att ributes;
It's just the last line that I am missing....Some thing that would look like:
o.SetAttributes (attrsNew);
Any hope for this to succeed? I mean ANY way? Even if a nightmare....?
Thank you ,
Sky 2 2929
You cannot modify the attributes of a compiled type in an assembly.
--
Jared Parson [MSFT] ja******@online .microsoft.com
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
"S.Sigal" <as*******@xa ct-solutions.remov ethis.com> wrote in message
news:eL******** ******@TK2MSFTN GP11.phx.gbl... Hello:
I've seen code in some books for databinding that handles attaching Attributes to Properties during runtime...which is very close (but no cigar) to what I am looking for...
The code in the book was basically the following:
override protected void PreFilterProper ties(IDictionar y properties) { base.PreFilterP roperties(prope rties); PropertyDescrip tor prop = (PropertyDescri ptor)properties["DataSource "]; if(prop!=null) { System.Componen tModel.Attribut eCollection runtimeAttribut es = prop.Attributes ; // make a copy of the original attributes but make room for one extra attribute //ie the TypeConverter attribute Attribute[] attrs = new Attribute[runtimeAttribut es.Count + 1]; runtimeAttribut es.CopyTo(attrs , 0); attrs[runtimeAttribut es.Count] = new TypeConverterAt tribute(typeof( DataSourceConve rter)); prop = TypeDescriptor. CreateProperty( this.GetType(), "DataSource ", typeof(string), attrs); properties["DataSource "] = prop; }...
Although this is not what I want -- it intrigues me, because one of the things I wish to do is change the Designer attribute on a Control on the fly -- specifically, to change a Control's ControlDesigner attribute from standard ControlDesigner to ReadWriteDesign er --- and back again -- to get around the limitations that are in the IDE...
Only problem is that I don't see anywhere in the Framwork where to SET attributes... I can read them, and can append to them as above snippet shows: System.Componen tModel.Attribut eCollection attrsExist = o.GetType().Att ributes; It's just the last line that I am missing....Some thing that would look like: o.SetAttributes (attrsNew);
Any hope for this to succeed? I mean ANY way? Even if a nightmare....?
Thank you , Sky
Thanks Jared.
It's what I suspected, but was hoping someone would prove me wrong...
Sky
"Jared Parsons [MSFT]" <ja******@onlin e.microsoft.com > wrote in message
news:eU******** ******@TK2MSFTN GP15.phx.gbl... You cannot modify the attributes of a compiled type in an assembly.
-- Jared Parson [MSFT] ja******@online .microsoft.com
This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
"S.Sigal" <as*******@xa ct-solutions.remov ethis.com> wrote in message news:eL******** ******@TK2MSFTN GP11.phx.gbl... Hello:
I've seen code in some books for databinding that handles attaching Attributes to Properties during runtime...which is very close (but no cigar) to what I am looking for...
The code in the book was basically the following:
override protected void PreFilterProper ties(IDictionar y properties) { base.PreFilterP roperties(prope rties); PropertyDescrip tor prop = (PropertyDescri ptor)properties["DataSource "]; if(prop!=null) { System.Componen tModel.Attribut eCollection runtimeAttribut es = prop.Attributes ; // make a copy of the original attributes but make room for one extra attribute //ie the TypeConverter attribute Attribute[] attrs = new Attribute[runtimeAttribut es.Count + 1]; runtimeAttribut es.CopyTo(attrs , 0); attrs[runtimeAttribut es.Count] = new TypeConverterAt tribute(typeof( DataSourceConve rter)); prop = TypeDescriptor. CreateProperty( this.GetType(), "DataSource ", typeof(string), attrs); properties["DataSource "] = prop; }...
Although this is not what I want -- it intrigues me, because one of the things I wish to do is change the Designer attribute on a Control on the fly -- specifically, to change a Control's ControlDesigner attribute from standard ControlDesigner to ReadWriteDesign er --- and back again -- to get around the limitations that are in the IDE...
Only problem is that I don't see anywhere in the Framwork where to SET attributes... I can read them, and can append to them as above snippet shows: System.Componen tModel.Attribut eCollection attrsExist = o.GetType().Att ributes; It's just the last line that I am missing....Some thing that would look like: o.SetAttributes (attrsNew);
Any hope for this to succeed? I mean ANY way? Even if a nightmare....?
Thank you , Sky
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dan Perl |
last post by:
There is something with initializing mutable class attributes that I am
struggling with. I'll use an example to explain:
class Father:
attr1=None # this is OK
attr2= # this is wrong
def foo(self, data):
self.attr1=data
self.attr2.append(data)
The initialization of attr1 is obviously OK, all instances of Father
redefine it in the method foo. But the initialization of attr2 is wrong
|
by: Matthew Bell |
last post by:
Hi,
I've got a question about whether there are any issues with directly
calling attributes and/or methods of a threaded class instance. I
wonder if someone could give me some advice on this.
Generally, the documentation suggests that queues or similar constructs
should be used for thread inter-process comms. I've had a lot of
success in doing that (generally by passing in the queue during the
__init__ of the thread) and I can see...
|
by: Vladimir C. |
last post by:
Hashtable map = new Hashtable();
map = 10;
map = 20;
foreach(DictionaryEntry e in map)
{
e.Value = 100;
Console.WriteLine("{0}: {1}", key, map);
}
|
by: Tyler Carver |
last post by:
I have created a web reference in a 2005 web project and need to change out
the generated complex class with the business oject that we have already
created. In a library project there is a code file for the proxy class where
I can make the change. However, there is no such file in a Web Project as
this class is generated on the fly. So what I need to do is the following:
I have a business object Foo.
My Webservice has a method...
|
by: Glenn |
last post by:
Hi
Here's the scenario...
I have a web method to which a pass a customer ID. The web method looks up
the customer and returns an XmlNode which I deserialise into a type. I then
update information in the type and then serialise it back into an
XmlDocument ready for submission to another web method. The problem is that
during serialisation, some, but not all attributes are not being created in
the document.
| |
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,...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |