翻譯|使用教程|編輯:龔雪|2021-06-29 10:28:00.283|閱讀 351 次
概述:本教程介紹如何創建.NET 5 應用程序,將其配置為使用 DevExpress WPF控件,以及添加Spreadsheet控件。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
DevExpress WPF擁有120+個控件和庫,將幫助您交付滿足甚至超出企業需求的高性能業務應用程序。通過DevExpress WPF能創建有著強大互動功能的XAML基礎應用程序,這些應用程序專注于當代客戶的需求和構建未來新一代支持觸摸的解決方案。 無論是Office辦公軟件的衍伸產品,還是以數據為中心的商業智能產品,都能通過DevExpress WPF控件來實現。
本教程介紹如何創建.NET 5 應用程序,將其配置為使用 DevExpress WPF控件,以及添加Spreadsheet控件。
下載DevExpress v21.1完整版 DevExpress v21.1漢化資源獲取
打開 Visual Studio 2019 并創建一個新項目,選擇DevExpress v21.1 WPF App Template Gallery模板。
指定項目名稱和位置。
在DevExpress Template Gallery中,選擇.Net Core平臺、Blank Application模板和.NET 5.0版本。
在Solution Explorer中右鍵單擊項目,然后選擇Edit Project File。
將 UseWindowsForms 鍵設置為 true:
XAML
<PropertyGroup> <OutputType>WinExe</OutputType> <TargetFramework>net5.0-windows</TargetFramework> <UseWPF>true</UseWPF> <UseWindowsForms>true</UseWindowsForms> </PropertyGroup>
注意:
許多 DevExpress 產品都有一個跨平臺的核心部分,它依賴于 Windows Forms 程序集,因此建議將 UseWindowsForms 標志設置為 true。
1. 跳轉到Tools | NuGet Package Manager | Manage NuGet Packages for Solution。
2. 在“Browse”標簽中,搜索“WindowsDesktop.Wpf.Themes”關鍵字并為當前項目安裝 DevExpress.WindowsDesktop.Wpf.Themes.All 包,接受許可協議。
3. 構建解決方案。
1. 打開MainWindow.xaml。
2. 添加以下 DevExpress 命名空間引用:
XAML
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
3. 將Spreadsheet控件從Visual Studio 工具箱拖動到 XAML 代碼,更改應用程序標記如下:
XAML
<dx:ThemedWindow x:Class="DxWPFNetCoreApp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dxsps="http://schemas.devexpress.com/winfx/2008/xaml/spreadsheet" xmlns:local="clr-namespace:DxWPFNetCoreApp" Title="MainWindow" Height="450" Width="800"> <Grid> <dxsps:SpreadsheetControl CommandBarStyle="Ribbon" ShowFormulaBar="True"/> </Grid> </dx:ThemedWindow>
4. 構建并運行解決方案。
DevExpress技術交流群4:715863792 歡迎一起進群討論
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都網