Installing DevExtreme Controls into a DevExpress XAF Blazor Project
Step 1: Copy DevExtreme Assets to Your Project
To integrate DevExtreme controls into your DevExpress XAF Blazor project, begin by copying essential files:
- Navigate to the DevExtreme library directory on your system:
C:\Program Files\DevExpress {your installed version #}\DevExtreme\Sources\Lib
- Copy the following directories:
css
js
ts
- Paste them into the
wwwroot
folder of your{YourProjectName}.Blazor.Server
project.
Step 2: Configure DevExtreme License
DevExtreme requires a license key for proper operation. Follow these steps to set up licensing:
- Visit the DevExpress Download Manager:
- Expand your DevExtreme Subscription and click the “(Copy your license key to the CLIPBOARD)” link.
- In your
{YourProjectName}.Blazor.Server
project, create a new JavaScript file nameddevextreme-license.js
in the root directory. - Add the following content, replacing
{your license key}
with the copied key:DevExpress.config({ licenseKey: '{your license key}' });
- Save the file.
Step 3: Import DevExtreme CSS and JS Files
Modify your _Host.cshtml
file to include DevExtreme dependencies. The correct order of imports is crucial.
a. Import jQuery
<script type="text/javascript" src="js/jquery-3.5.1.min.js"></script>
b. Import Specific DevExtreme Controls (If Needed)
Some DevExtreme controls, such as dxDiagram
, require additional imports. Check the DevExtreme Documentation for your specific control.
<script src="~/js/dx-diagram.min.js"></script>
<link rel="stylesheet" href="~/css/dx-diagram.min.css">
c. Add DevExtreme Themes
<link rel="stylesheet" href="css/dx.light.css">
You can find a list of predefined themes here.
d. Import Core DevExtreme JavaScript Library
<script type="text/javascript" src="js/dx.all.js"></script>
Final Notes
- Ensure that the DevExtreme files are accessible in the
wwwroot
folder. - The order of scripts and styles in
_Host.cshtml
is essential for proper rendering. - Check the official DevExtreme guide for further details.
With these steps completed, you should be able to use DevExtreme controls within your DevExpress XAF Blazor project.