Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / July 2004

Tip: Looking for answers? Try searching our database.

How to use property page

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Munir Husseini - 02 Jul 2004 14:59 GMT
Hi,

I am trying to create my own editor as a Visual Studio Integration Package
using C#.

I used the Wizard provided by VSIP SDK, replaced the text editor with my own
control and all worked fine.

No depending on what my editor control shows, some properties should be
shown on the properties window.

How can I do this? How doe I get the properties window and how can I fill
it?

Any help would be appreciated.
Munir Husseini - 02 Jul 2004 16:22 GMT
I've found some of the answers out myself by now.
Using the ITrackSelection.OnSelectChange()  I can make the IDE ask for a
property page.
I have to implement the ISelectionContainer interface to be able to provide
an object which properties should appear in the property page.

So far, so good. But what objects can I return?
I mean ISelectionContainer.GetObjects() should fill the apUnkObjects
parameter with objects which properties should be exposed. I guess I should
return an object implementing IDispatch, but how can I do this in C#?

Thanks.
Bill Foust - 02 Jul 2004 19:54 GMT
return any objects. The PropertyGrid will use reflection to find the
properties of that object and use them to populate the grid. you can set
attributes to specify the description, category and whether it should be
shown. Custom property editors however won't work 'out of the box'. you need
some additional code.

Bill

> I've found some of the answers out myself by now.
> Using the ITrackSelection.OnSelectChange()  I can make the IDE ask for a
[quoted text clipped - 8 lines]
>
> Thanks.
Munir Husseini - 09 Jul 2004 16:28 GMT
Thank you for the reply,

unfortionatly the property grid shows nothing at all when I return an
object.

I have a class defined somthing like

public class Item
{
   private string _Name = string.empty;
   public string Name
   {
       get
       {
           return _Name;
       }
       set
       {
           _Name = vakue;
       }
   }
}

Then in ISelectionContainer.CountObjects(uint dwFlags, out uint pc)  I set
pc = 1.
In ISelectionContainer.GetObjects(uint dwFlags, uint cObjects, object[]
apUnkObjects) I set apUnkObjects[0] = item where item is of type Item.

As I said, the property grid shows nothing, not even a name in the object
drop down.

I guess that the relfection mechanism only applies when a ComponentEditor-
derived editor is used. What the raw IDE uses seems to be an Acrtive-X
property page.

> return any objects. The PropertyGrid will use reflection to find the
> properties of that object and use them to populate the grid. you can set
[quoted text clipped - 18 lines]
> >
> > Thanks.
Munir Husseini - 09 Jul 2004 17:07 GMT
Ok, now I get it.

There seems to be a problem when using VSIP since the property grid is
managed code.
This link has the solution:

http://blogs.msdn.com/allend/archive/2004/04/09/110303.aspx

> Thank you for the reply,
>
[quoted text clipped - 54 lines]
> > >
> > > Thanks.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.