如何使用 VisualStudio 2019 获取 Microsoft.Toolkit.Uwp.UI.Controls 中控件的 UWP 默认模板(样式代码)?

How to get Default Template(Style Code) of UWP for Controls in Microsoft.Toolkit.Uwp.UI.Controls using VisualStudio 2019?

我在我的 UWP 项目中包含了 Microsoft.Toolkit.Uwp.UI.Controls 的 Nuget 包。 我尝试使用 VS2019 获取此包内任何控件(如 DataGrid)的默认模板。但是,编辑模板-->编辑复制选项被禁用。如何获取此包的默认模板和样式?

来自 Microsoft.UI.Xaml 的控件,如按钮、文本框等。具有编辑复制选项。仅工具包包中的控件不可用。为什么?

是的,这与使用WinUI 2.X NuGet 包时的WinUI 控件相同,您不能直接从Visual Studio.

创建默认样式

How to get the default Template and Styles of this Package?

你可以去 Github page of Community Toolkit and check the source code of the Community controls. For example, you could find the style of DataGrid here:DataGrid.xaml.