我应该使用 Visual Studio 命令 Table (.Vsct) 文件吗
Should I use a Visual Studio Command Table (.Vsct) File
我使用 Microsoft 此处描述的工具 window 创建了一个新的 Visual Studio 扩展
https://docs.microsoft.com/en-us/visualstudio/extensibility/creating-an-extension-with-a-tool-window?view=vs-2019
这会生成多个文件,包括工具 window 的 XAML 定义。
我想向工具 window 添加一个工具栏,因此我可以在 XAML 中定义它,并将按钮连接到我的视图模型中的一些命令对象。这是有吸引力的,因为我已经熟悉如何做。
但是,在另一页上,
https://docs.microsoft.com/en-us/visualstudio/extensibility/adding-a-tool-window?view=vs-2019
Microsoft 描述了如何使用 Visual Studio 命令 Table (.Vsct) 文件添加工具栏。
乍一看,它看起来很复杂,我认为我不需要它。
描述确实如此
By adding a toolbar in the following manner, you guarantee that its
gradients and colors are consistent with the rest of the IDE.
除此之外,使用 VSCT 方法的优势是什么?
使用 VSCT 方法,用户将能够编辑工具栏并为其命令分配键盘快捷键。并且不要低估为不同的 VS 主题设置 XAML 工具栏样式的必要性。
就个人而言,我根据需要使用这两种方法来公开标准 VS 自定义命令。
我使用 Microsoft 此处描述的工具 window 创建了一个新的 Visual Studio 扩展 https://docs.microsoft.com/en-us/visualstudio/extensibility/creating-an-extension-with-a-tool-window?view=vs-2019
这会生成多个文件,包括工具 window 的 XAML 定义。
我想向工具 window 添加一个工具栏,因此我可以在 XAML 中定义它,并将按钮连接到我的视图模型中的一些命令对象。这是有吸引力的,因为我已经熟悉如何做。
但是,在另一页上, https://docs.microsoft.com/en-us/visualstudio/extensibility/adding-a-tool-window?view=vs-2019 Microsoft 描述了如何使用 Visual Studio 命令 Table (.Vsct) 文件添加工具栏。
乍一看,它看起来很复杂,我认为我不需要它。
描述确实如此
By adding a toolbar in the following manner, you guarantee that its gradients and colors are consistent with the rest of the IDE.
除此之外,使用 VSCT 方法的优势是什么?
使用 VSCT 方法,用户将能够编辑工具栏并为其命令分配键盘快捷键。并且不要低估为不同的 VS 主题设置 XAML 工具栏样式的必要性。
就个人而言,我根据需要使用这两种方法来公开标准 VS 自定义命令。