![]() The following image illustrates the resulting form after it has been opened at runtime. In this example, the DXErrorProvider.DataSource property is set to the BindingSource. To automatically track errors supplied by a data source, the DXErrorProvider component must be bound to this data source via the DXErrorProvider.DataSource property. It indicates errors as error icons, which can be hovered over to display error text. To display the supplied errors within the editors, a DXErrorProvider component needs to be added to the form. The MyRecord class implements the IDXDataErrorInfo interface and returns the error information via the IDXDataErrorInfo.GetPropertyError method. ![]() In this example, the error information is provided on the data source level. The requirement is to visually indicate errors within the editors, if the record’s FirstName or LastName property contain an empty string. This class’ records are stored in a BindingSource component and edited using text editors (the FirstName and LastName properties are edited in a textEdit1 and textEdit2 controls respectively). It contains two properties ( FirstName and LastName) that cannot be empty. In this example, the business object is represented by a custom MyRecord class. Error information will be handled by the DXErrorProvider component, which will indicate any error to an end-user. The following example demonstrates how to implement error notifications for a custom business object at the data source level, using the IDXDataErrorInfo interface. To avoid conflicts that can occur at run time, when changing the DataSource and DataMember, use the DXErrorProvider.BindToDataAndErrors method, instead of setting the DataSource and DataMember individually. Typically, this property must be set to the form that owns editors. The DXErrorProvider will monitor the data source for errors, and if errors are associated with specific properties, will display error icons within the corresponding bound editors.įor error icons to be displayed correctly, the DXErrorProvider.ContainerControl property must be set to the control that contains bound editors. create a DXErrorProvider component, and bind it to the data source (a collection of business objects) via the DataSource and DXErrorProvider.DataMember properties.Errors need to be provided using the IDXDataErrorInfo.GetPropertyError method. implement the IDXDataErrorInfo interface for a business object (a class that represents a record in the data source).To implement value validation on the data source level, and visually indicate errors in bound editors, do the following: When this icon is hovered over, an error description will pop up. As a result, the bound editor will display an error icon. If a specific property’s value doesn’t match specific requirements, an error can be associated with this property. Values of bound editors can be validated on the data source level. Public Property DataSource As Object Property Value TypeĪn object which represents the data source. Int targetRowIndex = targetGrid.GetDataSourceRowIndex(targetRowHandle) įoreach (int sourceHandle in sourceHandles) ") GridHitInfo hitInfo = targetGrid.CalcHitInfo(hitPoint) If (e.Action = DragDropActions.None || targetGrid != sourceGrid)ĭataTable sourceTable = as DataTable GridView sourceGrid = e.Source as GridView GridView targetGrid = e.Target as GridView Private void Behavior_DragDrop(object sender, DragDropEventArgs e) I need to re-order the group rows(include their details) by drag and drop using BehaviorManager(in addition to re-ordering the rows inside the details).įor drag&drop rows I wrote following codes: private void Behavior_DragOver(object sender, DragOverEventArgs e)ĭragOverGridEventArgs args = DragOverGridEventArgs.GetDragOverGridEventArgs(e) Į.InsertIndicatorLocation = args.InsertIndicatorLocation I'm using DevExpress controls in my WinForms project.
0 Comments
Leave a Reply. |