Skip to content

Inherit from DevExpress Blazor components. Override the SetParametersAsync and SetParametersAsyncCore methods and specify custom default values for all components of the same kind.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/blazor-default-settings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevExpress Blazor Components - Set predefined settings for a specific component

Controls generally have the same settings across different pages within a large web application. We recommend that you specify these component settings in markup. You can also override the SetParametersAsyncCore (for the Grid and Editors) or the SetParametersAsync (for other components) method to specify default settings for Blazor components used within in your application.

Grid with predefined settings and default

Create an inheritor from our Blazor control to override the SetParametersAsync or SetParametersAsyncCore method. You can set the default initial values for the public properties in either the SetParametersAsync or SetParametersAsyncCore method before you call the base SetParametersXXX method. In markup, you can initialize properties with modified default values since the base method is called after custom settings are applied.

Note: You should not override and change the values of protected properties. Such changes may generate unexpected outcomes.

In this example, the MyGrid component contains an inherited DxGrid component whose PageSize, ShowFilterRow, AllowSort, and ShowGroupPanel properties contain new default values. You can compare the MyGrid component to the original DxGrid component on the Index page to ensure they have the same settings in markup.

You cannot use this technique for DxChartXXXSeries components and specify the ValueField, ArgumentField, NameField, and PaneField properties.

Files to Review

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

About

Inherit from DevExpress Blazor components. Override the SetParametersAsync and SetParametersAsyncCore methods and specify custom default values for all components of the same kind.

Topics

Resources

License

Stars

Watchers

Forks