I'm writing a Visual Studio extension that allows editing the properties of an object in the Properties Window. I use the ITrackSelection interface to select the object I want to edit, and it all works fine, the properties are shown in the window and I can edit them.
However, I can't make Visual Studio refresh the Properties Window when a property is changed externally. I tried implementing INotifyPropertyChanged, but the PropertyChanged event is never subscribed. I also tried implementing ICustomTypeDescriptor and returning custom PropertyDescriptor objects with overrides for AddValueChanged and SupportsChangeEvents, but those are never called.
What I'm missing? How can I tell Visual Studio that a property of my object has changed and the Property Window has to be updated?
IVsUIShell.RefreshPropertyBrowser should do the trick and update the Property Window.
Related
I was looking for so long how to generate automatically event handlers for example for a button in a WEB PROJECT. In properties window there is no icon for adding event handlers. If somebody knows how to add it to one of the navigation windows I will be glad to see the answer.
The screen how it looks in my Visual Studio 2012:
http://imageshack.us/photo/my-images/35/fh6.png/
When I am in a C# Forms projects I can see this event handler icon in a properties window.
This takes relatively long time to save edmx.
Any help will be appreciated.
Btw, I do not know if this is behavior added to studio by some add-in!
There is a property, on ConceptualEntityModel's properties, called Transform Related Text Templates On Save.
(Right click on empty surface on designer and click on properties)
I just had to make it False!
In visual studio 2010 if I add a watch to a property of an object, by right clicking the property and going to add watch, in the watch window it just adds the property name instead of object.property name and hence it will also show "xxx does not exist in the current context".
Am I going about this the wrong way or is this a bug in visual studio?
I can get the watch to work by typing object.property manually in the watch window but it seems to defeat the whole purpose of that menu item being there.
I would suggest that you should select the object.property completely and then add it to the watch window.
In the forms designer of Visual Studio 2010, you can auto-generate event handlers (mostly done by double-clicking on the control that you want an event handler created for). However, I cannot determine how to auto-generate a closing event handler (not a closed event handler). Can any of you VS2010 gurus show me the way? Not sure if this matters, but this is for a Visual C# program.
To clarify, I'm looking for a way to auto-generate the closing event handler (this event happens when a user clicks the close/cancel button, but fires before the app actually closes).
Thanks!
Click on the window of your application and in the properties section (bottom right), click on the events tab, and then go to the Close and then type in a name of the method and it should create one for you in the code-behind.
I'm working with Visual studio 2008.
I have a form inherited from DockContent class (Weifen Luo dock panel suite if you ever heard about that library).
I can add another controls on that form. But when I tried to add an event handler via Property tab, Visual studio generated an exception "type is not marked as serializable".
What should I do to fix that problem ?
I'm guessing the class you are working with has the [Serializable] attribute. Because events are non-serializable, you will have to mark them this way.
[field:NonSerialized]
private EventHandler myEvent;