G
Guest
VS2005 / netcf application / custom controls / custom designer (running in
..NET)
I have a custom visual controls - UI editor which I need to port from .NET
towards .NETCF (its basically both a graphical editor and an XML serializer
for separating the GUI code from the design).
Now both, VS designer and my designer need access to the control properties
attributes. I understand that with VS05 there are 2 DLLs generated - the
'regular' DLL used by the VS designer and the *asm.dll which is for the
device. In addition we have the XMTA design attributes data as XML file.
Now, in order to access design time attributes for custom controls: I
somehow don't get access to them through the DLL. I tried a lot of different
things but I can only get attributes that are inherited but not the
attributes which belong to my custom property e.g. Text1 (see debug output of
my reflection results below).
What am I missing or (I almost suspect) is the VS designer just reading the
XMTA and adding the attributes 'in parallel / through a side-door' ?
Here's my code snip: - it gets to the types but does not have any results on
custom property attributes:
foreach (Type t in mytypes)
{
Console.WriteLine("Type: " + t.Name);
PropertyInfo[] pi = t.GetProperties();
foreach (PropertyInfo p in pi)
{
Console.WriteLine("Property: " + p.Name);
Object[] myAttributes =
p.GetCustomAttributes(inheritFlag);
ShowAttributeData(CustomAttributeData.GetCustomAttributes(p));
}
}
***************
Property: Text1
No Attributes
Property: AutoSiz
[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)0)]
[System.ComponentModel.BrowsableAttribute((Boolean)True)
[System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)1)]
Property: AutoSizeMode
[System.ComponentModel.BrowsableAttribute((Boolean)True)]
[System.Windows.Forms.SRCategoryAttribute("CatLayout")]
..
...
....
..NET)
I have a custom visual controls - UI editor which I need to port from .NET
towards .NETCF (its basically both a graphical editor and an XML serializer
for separating the GUI code from the design).
Now both, VS designer and my designer need access to the control properties
attributes. I understand that with VS05 there are 2 DLLs generated - the
'regular' DLL used by the VS designer and the *asm.dll which is for the
device. In addition we have the XMTA design attributes data as XML file.
Now, in order to access design time attributes for custom controls: I
somehow don't get access to them through the DLL. I tried a lot of different
things but I can only get attributes that are inherited but not the
attributes which belong to my custom property e.g. Text1 (see debug output of
my reflection results below).
What am I missing or (I almost suspect) is the VS designer just reading the
XMTA and adding the attributes 'in parallel / through a side-door' ?
Here's my code snip: - it gets to the types but does not have any results on
custom property attributes:
foreach (Type t in mytypes)
{
Console.WriteLine("Type: " + t.Name);
PropertyInfo[] pi = t.GetProperties();
foreach (PropertyInfo p in pi)
{
Console.WriteLine("Property: " + p.Name);
Object[] myAttributes =
p.GetCustomAttributes(inheritFlag);
ShowAttributeData(CustomAttributeData.GetCustomAttributes(p));
}
}
***************
Property: Text1
No Attributes
Property: AutoSiz
[System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)0)]
[System.ComponentModel.BrowsableAttribute((Boolean)True)
[System.ComponentModel.DesignerSerializationVisibilityAttribute((System.ComponentModel.DesignerSerializationVisibility)1)]
Property: AutoSizeMode
[System.ComponentModel.BrowsableAttribute((Boolean)True)]
[System.Windows.Forms.SRCategoryAttribute("CatLayout")]
..
...
....