Numeric Properties(数字属性)
XAF supports Property Editors for numeric data types (byte, int, decimal, long, corresponding nullable types, etc.) on all platforms. However, WinForms, ASP.NET Web Forms, and Blazor UI applications use different formatting rules depending on the underlying property type.
XAF支持所有平台上数字数据类型(byte、int、decimal、long、相应的可空类型等)的属性编辑器。但是,WinForms、ASP.NETWeb Forms和Blazor UI应用程序根据基础属性类型使用不同的格式规则。
Refer to the following topics for information on how to add Numeric properties to business classes in the supported ORM systems:
有关如何在支持的ORM系统中将数字属性添加到业务类的信息,请参阅以下主题:
- Numeric Properties in XPO(XPO中的数字属性)
- Numeric Properties in EF Core(EF Core中的数字属性)
ASP.NET Core Blazor
In ASP.NET Core Blazor, BlazorPropertyEditorBase.ComponentModel returns an IComponentModel descendant that wraps properties and events of a corresponding ASP.NET Core Blazor Editor.
在ASP.NETCore Blazor中,BlazorPropertyEditorBaseComponentModel返回一个IComponentModel后代,它包装了相应ASP.NETCore Blazor Editor的属性和事件。
NumericPropertyEditor
Component Model: DevExpress.ExpressApp.Blazor.Components.Models.DxSpinEditModel<T>.
组件模型:DevExpress. ExpressApp.Blazor.Components.Model.DxSpinEditModel<T>。
Component: the DxSpinEdit<T> editor shipped with the DevExpress ASP.NET Core Blazor Library.
组件:DevExpressASP.NETCore Blazor库附带的DxSpinEdit<T>编辑器。
Description:
描述:
This is the default Property Editor for the following numeric property types: Int16, UInt16, Int32, UInt32, Int64, UInt64, float, double, Decimal, byte.
这是以下数字属性类型的默认属性编辑器:Int16、UInt16、Int32、UInt32、Int64、UInt64、 float、 double、 Decimal、 byte。
To access and customize UI controls in XAF applications, create a ViewController that accesses a NumericPropertyEditor object to modify the underlying DxSpinEdit control. For more information, refer to the following topic: Access the Settings of a Property Editor in a Detail View.
要访问和自定义XAF应用程序中的UI控件,请创建访问NumericPropertyEditor对象以修改底层DxSpinEdit控件的ViewController。有关详细信息,请参阅以下主题:在详细信息视图中访问属性编辑器的设置。
Disable Mouse Wheel Functionality(禁用鼠标滚轮功能)
Users can scroll the mouse wheel to change the NumericPropertyEditor‘s value. To disable this behavior, ensure that the DxSpinEdit.AllowMouseWheel property is set to false.
用户可以滚动鼠标滚轮来更改NumericPropertyEditor的值。要禁用此行为,请确保DxSpinEdit. AllowMouseWheel属性设置为false。
C#
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Blazor.Editors;
public class CustomizeNumericPropertyEditorController : ViewController {
protected override void OnActivated() {
base.OnActivated();
if(View is ListView { Editor: DxGridListEditor gridListEditor }) {
gridListEditor.CustomizeViewItemControl<NumericPropertyEditor>(this, CustomizePropertyEditor);
}
else if(View is DetailView detailView) {
detailView.CustomizeViewItemControl<NumericPropertyEditor>(this, CustomizePropertyEditor);
}
}
private void CustomizePropertyEditor(NumericPropertyEditor numericPropertyEditor) {
numericPropertyEditor.ComponentModel.AllowMouseWheel = false;
}
}
Hide Spin Buttons(隐藏旋转按钮)
A NumericPropertyEditor displays spin buttons that allow users to change the editor’s value. To hide these buttons, ensure that the DxSpinEdit.ShowSpinButtons property is set to false.
NumericPropertyEditor显示允许用户更改编辑器值的旋转按钮。要隐藏这些按钮,请确保DxSpinEdit. ShowSpinButton属性设置为false。
C#
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Blazor.Editors;
public class CustomizeNumericPropertyEditorController : ViewController {
protected override void OnActivated() {
base.OnActivated();
if(View is ListView { Editor: DxGridListEditor gridListEditor }) {
gridListEditor.CustomizeViewItemControl<NumericPropertyEditor>(this, CustomizePropertyEditor);
}
else if(View is DetailView detailView) {
detailView.CustomizeViewItemControl<NumericPropertyEditor>(this, CustomizePropertyEditor);
}
}
private void CustomizePropertyEditor(NumericPropertyEditor numericPropertyEditor) {
numericPropertyEditor.ComponentModel.ShowSpinButtons = false;
}
}
Apply Numeric Mask(应用数字蒙版)
To apply a mask to a NumericPropertyEditor, use the EditMask property and the Numeric mask type syntax.
若要将掩码应用到NumericPropertyEditor,请使用EditMask属性和数字掩码类型语法。
To further customize the mask, access the NumericPropertyEditor.MaskProperties property.
要进一步自定义掩码,请访问NumericPropertyEditor. MaskProperties属性。
For an example, refer to the following topic: Access EditMask In Code.
例如,请参阅以下主题:在代码中访问EditMask。
WinForms
Each Windows Forms Property Editor is available in two forms:
每个Windows窗体属性编辑器都有两种形式:
- A standalone control (displays property value in a Detail View)(独立控件(在详细信息视图中显示属性值))
- A repository item (displays property value in a List Editor that supports in-place editing)(存储库项(在支持就地编辑的列表编辑器中显示属性值))
BytePropertyEditor
Control: IntegerEdit – a descendant of the SpinEdit editor shipped with the XtraEditors Library.
控件:IntegerEdit-XtraEditor库附带的SpinEdit编辑器的后代。
Repository Item: RepositoryItemIntegerEdit – a descendant of the XtraEditors Library’s RepositoryItemSpinEdit item.
存储库项:RepositoryItemIntegerEdit-XtraEditor库RepositoryItemSpinEdit项的后代。
Description:
描述:
This is the default Property Editor for byte properties.
这是字节属性的默认属性编辑器。
The editor is a descendant of the IntegerPropertyEditor class. If the repository item’s MaxValue property is set to 0 or to a value that exceeds Byte.MaxValue, the property value is reset to Byte.MaxValue. If the repository item’s MinValue property is set to 0 or to a value that is less than Byte.MinValue, the property value is reset to Byte.MinValue.
编辑器是IntegerPropertyEditor类的后代。如果存储库项的MaxValue属性设置为0或超过Byte. MaxValue的值,则属性值重置为Byte.MaxValue。如果存储库项的MinValue属性设置为0或小于Byte.MinValue的值,则属性值重置为Byte.MinValue。
DecimalPropertyEditor
Control: DecimalEdit – a descendant of the SingleEdit editor used by the FloatPropertyEditor.
控件:DecimalEdit-FloatProperty tyEditor使用的SingleEdit编辑器的后代。
Repository Item: RepositoryItemDecimalEdit – a RepositoryItemSingleEdit item descendant used by the FloatPropertyEditor.
存储库项:RepositoryItemDecimalEdit-FloatProperty tyEditor使用的RepositoryItemSingleEdit项后代。
Description:
描述:
This is the default Property Editor for decimal properties.
这是十进制属性的默认属性编辑器。
The RepositoryItemSingleEdit class helps to store and display values using the C Numeric edit mask when the Property Editor’s EditMask is not specified.
RepositoryItemSingleEdit类有助于在未指定属性编辑器的EditMask时使用C数字编辑掩码存储和显示值。
DoublePropertyEditor
Control: DoubleEdit – a SingleEdit editor descendant used by the FloatPropertyEditor.
控件:DoubleEdit-FloatProperty tyEditor使用的SingleEdit编辑器后代。
Repository Item: RepositoryItemDoubleEdit – a RepositoryItemSingleEdit item descendant used by the FloatPropertyEditor.
存储库项:RepositoryItemDoubleEdit-FloatProperty tyEditor使用的RepositoryItemSingleEdit项后代。
Description:
描述:
This is the default Property Editor for double properties.
这是双属性的默认属性编辑器。
FloatPropertyEditor
Control: SingleEdit – an IntegerEdit editor descendant used by the IntegerPropertyEditor.
控件:SingleEdit-IntegerPropertyEditor使用的IntegerEdit编辑器后代。
Repository Item: RepositoryItemSingleEdit – a RepositoryItemIntegerEdit item descendant used by the IntegerPropertyEditor.
存储库项:RepositoryItemSingleEdit-IntegerPropertyEditor使用的RepositoryItemIntegerEdit项后代。
Description:
描述:
This is the default Property Editor for float properties.
这是浮点属性的默认属性编辑器。
The RepositoryItemIntegerEdit class allows you to display float values.
RepositoryItemIntegerEdit类允许您显示浮点值。
IntegerPropertyEditor
Control: IntegerEdit – a descendant of the SpinEdit editor shipped with the XtraEditors Library.
控件:IntegerEdit-XtraEditor库附带的SpinEdit编辑器的后代。
Repository Item: RepositoryItemIntegerEdit – a descendant of the XtraEditors Library’s RepositoryItemSpinEdit item.
存储库项:RepositoryItemIntegerEdit-XtraEditor库RepositoryItemSpinEdit项的后代。
Description:
描述:
This is the default Property Editor for Int32 properties.
这是Int32属性的默认属性编辑器。
An IntegerPropertyEditor object has the EditMask property. This property’s default value is the Views | <DetailView> | Items | <PropertyEditor> node’s IModelCommonMemberViewItem.EditMask property value. When you assign a value to this property or to the EditMask attribute directly in code, use the syntax of the Numeric mask type. In this instance, the specified mask is applied to the property value displayed by the Property Editor. Refer to the following topic for more information: Mask Editors Overview | Mask Types.
IntegerPropertyEditor对象具有EditMask属性。此属性的默认值是Views|<DetailView>|Items|<Properties tyEditor>节点的IModelCommonMemberViewItem。EditMask属性值。当您直接在代码中为此属性或EditMask属性赋值时,请使用数字掩码类型的语法。在这种情况下,指定的掩码将应用于属性编辑器显示的属性值。有关详细信息,请参阅以下主题:掩码编辑器概述|掩码类型。
LongPropertyEditor
Control: IntegerEdit – a descendant of the SpinEdit editor shipped with the XtraEditors Library.
控件:IntegerEdit-XtraEditor库附带的SpinEdit编辑器的后代。
Repository Item: RepositoryItemIntegerEdit – a descendant of the XtraEditors Library’s RepositoryItemSpinEdit item.
存储库项:RepositoryItemIntegerEdit-XtraEditor库RepositoryItemSpinEdit项的后代。
Description:
描述:
This is the default Property Editor for Int64 properties.
这是Int64属性的默认属性编辑器。
The editor is an IntegerPropertyEditor class descendant. If the repository item’s MaxValue property is set to 0 or to a value that exceeds Long.MaxValue, the property value is reset to Long.MaxValue. If the repository item’s MinValue property is set to 0 or to a value that is less than Long.MinValue, the property value is reset to Long.MinValue.
编辑器是IntegerPropertyEditor类的后代。如果存储库项的MaxValue属性设置为0或超过Long. MaxValue的值,则属性值重置为Long.MaxValue。如果存储库项的MinValue属性设置为0或小于Long.MinValue的值,则属性值重置为Long.MinValue。
ASP.NET Web Forms
Each ASP.NET Web Forms Property Editor includes controls that display a property in a Detail View in View and Edit mode.
每个ASP.NETWeb窗体属性编辑器都包含在查看和编辑模式下的详细信息视图中显示属性的控件。
ASPxBytePropertyEditor
View mode control: Label.
查看模式控制:标签。
Edit mode control: the ASPxSpinEdit editor from the ASPxEditors Library.
编辑模式控件:ASPxEditor库中的ASPxSpinEdit编辑器。
Description:
描述:
This is the default Property Editor for byte properties.
这是字节属性的默认属性编辑器。
ASPxDecimalPropertyEditor
View mode control: Label.
查看模式控制:标签。
Edit mode control: the ASPxSpinEdit editor from the ASPxEditors Library.
编辑模式控件:ASPxEditor库中的ASPxSpinEdit编辑器。
Description:
描述:
This is the default Property Editor for decimal properties. The editor is inherited from the ASPxIntPropertyEditor class.
这是十进制属性的默认属性编辑器。编辑器继承自ASPxIntPropertyEditor类。
Uses the C edit mask and display format. This Property Editor also enables float value input.
使用C编辑掩码和显示格式。此属性编辑器还启用浮点值输入。
ASPxDoublePropertyEditor
View mode control: Label.
查看模式控制:标签。
Edit mode control: the ASPxSpinEdit editor from the ASPxEditors Library.
编辑模式控件:ASPxEditor库中的ASPxSpinEdit编辑器。
Description:
描述:
This is the default Property Editor for double properties. The editor is inherited from the ASPxFloatPropertyEditor class. Casts the editor’s value to the double type.
这是双精度属性的默认属性编辑器。编辑器继承自ASPxFloatPropertyEditor类。将编辑器的值转换为双精度类型。
ASPxFloatPropertyEditor
View mode control: Label.
查看模式控制:标签。
Edit mode control: the ASPxSpinEdit editor from the ASPxEditors Library.
编辑模式控件:ASPxEditor库中的ASPxSpinEdit编辑器。
Description:
描述:
This is the default Property Editor for single properties.
这是单个属性的默认属性编辑器。
The editor is inherited from the ASPxIntPropertyEditor class. Uses the F edit mask and display format. This Property Editor also enables float value input.
编辑器继承自ASPxIntPropertyEditor类。使用F编辑掩码和显示格式。此属性编辑器还启用浮点值输入。
ASPxIntPropertyEditor
View mode control: Label.
查看模式控制:标签。
Edit mode control: the ASPxSpinEdit editor from the ASPxEditors Library.
编辑模式控件:ASPxEditor库中的ASPxSpinEdit编辑器。
Description:
描述:
This is the default Property Editor for Int32 properties.
这是Int32属性的默认属性编辑器。
ASPxInt64PropertyEditor
View mode control: Label.
查看模式控制:标签。
Edit mode control: the ASPxSpinEdit editor from the ASPxEditors Library.
编辑模式控件:ASPxEditor库中的ASPxSpinEdit编辑器。
Description:
描述:
This is the default Property Editor for Int64 properties. The editor is inherited from the ASPxIntPropertyEditor class. Casts the editor’s value to the Int64 type.
这是Int64属性的默认属性编辑器。编辑器继承自ASPxIntPropertyEditor类。将编辑器的值转换为Int64类型。