microsoft / VSExtensibility

A repo for upcoming changes to extensibility in Visual Studio, the new extensibility model, and language server protocol.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DataGrid in ToolWindow cannot be set to editmode

ccav01 opened this issue · comments

Create a tool window, add a datagrid. Bind it to data, works great. But I cannot figure out how to get CanUserAddRows or CanUserDeleteRows behaviors to work (both properties are set "True"). I also cannot find any method to get it out of view mode and into edit. A crippled datagrid lacking crud isn't very useful. Also, there's no means of sending actual UI controls as the "sender" parameter to emulate events. the vs:ExtensibilityUICOmmands.EventHandlers does allow calling a command, however I cannot affect anything in the UI like idk, sending a reference to the datagrid as the sender object on the event so I can call dg.BeginEdit().

Hello,
The Remote UI model used in out of process extensions is fully MVVM. So there isn't support for calling methods on the DataGrid object or returning a reference to a UI control as the "sender" of a command. AsyncCommands are supposed to receive data-bound values as parameters, not control references.
The WPF data grid is not a very MVVM-friendly control as it often requires invoking methods on it in order to achieve most non trivial scenarios.
For sure adding a row won't work since the WPF side of things (that runs in devenv.exe) wouldn't know how to create a new object of the type required by the data-bound collection.
@tinaschrepfer, can we add a feature request in our backlog to provide a MVVM friendly data grid to extenders?