This example illustrates how to implement a custom report class. The complete description is available in the How to: Implement a Custom Report Class help topic.
How to: Implement a Custom Report Class
How to customize the appearance of a map shape title
This example demonstrates how to change the appearance of a map dot title.
To do this you should specify the MapItemsLayerBase.ShapeTitlesPattern property.
How to customize print preview settings when using Reports, Analysis and Printing modules in Windows Forms applications
This example demonstrates how to access and customize the PrintingSystem object, which is responsible for the print preview and export settings. In order to do this, the PrintingSettingsLoaded and CustomShowPreview events of the PrintingController and WinReportServiceController are handled respectively. Refer to the How to: Customize Export Options of the Printing System topic for details.
IMPORTANT NOTE
You can also customize some print preview settings via the corresponding properties of the report object in the report end-user designer. Refer to the XtraReport Members help topic for more details.
How to create a custom RangeTrackBarControl with multiple tick marks.
Sometimes it is useful to have the capability to edit multiple ranges using a single control. This can be introduced with a custom control – MultipleRangeTrackBar.
In this example we have implemented the following features and functionality:
1) The capability to have multiple tick marks within this control.
2) The EditValue property of this control is a special RangeListclass which contains a list of TrackBarRange instances.
3) A couple of methods are intended for adding, changing and removing ticks:
- AddNewRange(int minimum, int maximum) – add a new range at a specific position. If it intersects with one of the existing ranges it will not be created.
- AddNewRange() – add a new range at the (0, 0) position. It has the same behavior as the previous method.
- ChangeValue(int minimum, int maximum, int index) – changes the value of the thumb by a particular index in the EditValue’s list. The new value will be set to a new TracKBarRange object with a special minimum and maximum. If it intersects with one of the existing ranges it will not be changed.
- ChangeValue(TrackBarRange range, int index) – The new value will be set to the range parameter. It has the same behavior as the previous method.
- RemoveRange(int index) – removes the thumb, by a particular index in the EditValue’s list. The first range cannot be deleted. Calling this method with the 0 parameter will do nothing.
4) The new EditValueChanged and the EditValueChanging events fire after successful completion of any of the above methods. They also fire after changing the EditValue with a new RangeList instance.
5) The Intersect event with the IntersectEventArgs argument. Thumbs cannot be intersected in this control. When an end-user tries to intersect thumbs, this event is raised. This event allows you to specify whether or not a dragged thumb is about to be intersected. The event handler receives an argument of type IntersectEventArgs containing data related to this event:
- DraggedThumb – gets the index of the pair of ticks.
- ThumbType – gets the value of the ThubmType type that specifies the type of the dragged thumb (ThumbType .Maximum or ThumbType .Minimum).
- Value – gets the value where this intersection occurs.
6) The ThumbsCount property returns the number of thumbs.
7) A new method also was added:
GetValue(int index) – returns a TrackBarRange instance, which has a particular index in the EditValue list.
The current example shows how we implemented MultipleRangeTrackBar and how to use it.
Question Comments
Added By: Lorenzo Viola at: 5/20/2014 9:54:36 AM
Hello, very nice example !
I'm trying to draw on the background of the highlighted range a filled rectangle. So I'm trying to make this change on the "DrawRangeHighlight" method of your sample.
Could you please provide a working example so that the track bar will draw different filled coloured rectangles (color is being set on the rangelist) under every range ?
Thank you !
Best Regards
I've separated your question into another ticket - MultipleRangeTrackBar (E4443) - How to draw a colored rectangle between thumbs. Let's continue our discussion there.
How to reorder grid rows by drag and drop
This example extends the example provided in the How to allow an end-user to move the rows in a grid up and down if the grid is bound to a DataTable article with drag and drop functionality.
Question Comments
Added By: Micha Ben-Efraim at: 6/11/2012 2:11:54 AM
I copied this example for reordering the element of a list bound to the control and it works almost perfectly. The problem is that the control doesn't scroll during D&D: the list is longer as the displayed window. If I select the first or the last item in the list (first/last row) and want o move to the last/first position, which is not visible, the view should scroll somehow in order to show the target drop row. But it doesn't do it when I move the cursor to the top/bottom of the view.
Can it
Is possible to make this with the AdvBandedGridView?
I've tryed to make the same but in the:
Private Sub GridControl1_DragOver(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles GridControl1.DragOver
' If e.Data.GetDataPresent(GetType(GridHitInfo))
allways returns False, so never enters the IF.
Added By: softwaresupport@smec.com softwaresupport@smec.com at: 6/4/2014 5:43:37 AMHi created a new ticket for this implementation as i dont find that it works
Added By: softwaresupport@smec.com softwaresupport@smec.com at: 6/4/2014 5:44:03 AMHere is the ticket ID : T114366
Added By: Nikita (DevExpress Support) at: 6/4/2014 11:29:33 PMHello,
Ok, let's continue our discussion in this ticket.
How to sort a XtraPivotGrid by clicking on a field value
The PivotGrid allows sorting by any column. To do this, right click any field value and select an appropriate field to sort. Sometimes it is necessary to sort by any column by simply clicking on it. This example shows how to implement this behavior. Handle the MouseClick event and call the CalcHitInfo method to determine whether a field value was clicked:
[C#]PivotGridHitInfohInfo=pivotGridControl1.CalcHitInfo(e.Location);if(hInfo.HitTest==PivotGridHitTest.Value)HandleValueMouseClick(hInfo.ValueInfo);
The HandleValueMouseClick method should be implemented as follows:
[C#]privatevoidHandleValueMouseClick(PivotFieldValueEventArgse){ pivotGridControl1.BeginUpdate(); PivotAreaotherArea=GetOtherArea(e); List<PivotGridField>otherFields=pivotGridControl1.GetFieldsByArea(otherArea); for(inti= 0;i<otherFields.Count;i++){ otherFields[i].SortBySummaryInfo.Field=e.FieldCellViewInfo.Item.DataField; otherFields[i].SortBySummaryInfo.Conditions.Clear(); if(e.Field!=null&&e.Field.Area!=PivotArea.DataArea) otherFields[i].SortBySummaryInfo.Conditions.Add(newPivotGridFieldSortCondition(e.Field,e.Value)); } pivotGridControl1.EndUpdate();}
Here we determine the cross-area and fill the SortBySummaryInfo structure for cross-area fields. Condition e.Field != null is necessary to correctly handle Grand Totals.
If there are more than one field in the clicked area, we should create a separate SortBySummaryInfo condition for each field. To do this, we should modify the HandleValueMouseClick click method as follows:
[C#]privatevoidHandleValueMouseClick(PivotFieldValueEventArgse){ PivotGridField[]higherFields=e.GetHigherLevelFields(); object[]higherValues=newobject[higherFields.Length]; for(inti= 0;i<higherFields.Length;i++) higherValues[i]=e.GetHigherLevelFieldValue(higherFields[i]); pivotGridControl1.BeginUpdate(); PivotAreaotherArea=GetOtherArea(e); List<PivotGridField>otherFields=pivotGridControl1.GetFieldsByArea(otherArea); for(inti= 0;i<otherFields.Count;i++){ otherFields[i].SortBySummaryInfo.Field=e.FieldCellViewInfo.Item.DataField; otherFields[i].SortBySummaryInfo.Conditions.Clear(); for(intj= 0;j<higherFields.Length;j++){ otherFields[i].SortBySummaryInfo.Conditions.Add(newPivotGridFieldSortCondition(higherFields[j],higherValues[j])); } if(e.Field!=null&&e.Field.Area!=PivotArea.DataArea) otherFields[i].SortBySummaryInfo.Conditions.Add(newPivotGridFieldSortCondition(e.Field,e.Value)); } pivotGridControl1.EndUpdate();}
How to print a chart and show Its print preview
OBSOLETE - How to print ChartControl via SimpleLink (DXPrinting)
A corresponding functionality should be available out-of-the-box in a future update (see http://www.devexpress.com/issue=S32927).
In the example, a chart's image is obtained via the RenderTargetBitmap.Render method.
Note! Starting from v2014 vol 1, the chart control contains the built-in ChartControl.Print and ChartControl.ShowPrintPreview methods. To learn how to work with methods, refer to the How to print a chart and show Its print preview example.
Question Comments
Added By: Daniel Ellis at: 4/2/2013 7:40:09 AM
Thanks this gets me much further.
How to export a chart to HTML and MHT
To export the chart, use the appropriate ExportTo~ method (e.g., ExportToHtml, ExportToPdf, etc.)
How to configure dxDataGrid with Angular Approach
This example demonstrates how to display data from a data source in dxDataGrid created using the AngularJS approach.
See also:
Configure Widget - Angular Approach
Question Comments
Added By: Marion (DevExpress Support) at: 8/12/2014 6:21:57 AM
Hello,
To process your recent post more efficiently, I created a separate ticket on your behalf: T139489: How to configure dxDataGrid with Angular approach and handle the optionChanged event. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
How to copy last entered values into a newly created object, when using the Save and New action
This example covers a situation when an end-user fills DetailView information in batch mode. Sometimes it's necessary to duplicate last entered items into a new DetailView form.
For implementation details, please refer to the platform-independent NewValuesController class (see the NewObjectInit.Module project).
Basically, the current object is saved when the Save and New action is executed. After a new DetailView is initialized, the new object is updated using the previous object details.
Question Comments
Added By: Khaled Abdo at: 1/7/2013 5:31:25 PM
Exception when object has Lookup object.
--------------
Exception occurs while assigning the 'DetailView, ID:Person_DetailView' view to WinWindow:
The 'DevExpress.Persistent.BaseImpl.Address' object belongs to a different session.
Hello,
I already found the solution.
........modify code to be like below........
Person current = (Person)View.CurrentObject;
Address addressObjectByKey = current.Session.GetObjectByKey<Address>(person.Address1.Oid); ;
current.Address1 = addressObjectByKey;
current.FirstName = person.FirstName;
........
DevExpress are the best ^_^
You can find a variant of this implementation configurable from application model in www.expandframework.com v13.1.5.16 and later. (see also http://goo.gl/694UOG)
How to create the LabelControl's descendant that will support selecting and copying of its text?
There are circumstances when it's necessary to display any static information in the application. In these cases, the LabelControl or the TextEdit is used. The LabelControl has an important advantage - transparency, but it doesn't support selecting and copying its text. In turn, the TextEdit doesn't support transparency, but at the same time this editor allows an end-user to select & copy an arbitrary part of its content.
To obtain a control that will be own advantages of the TextEdit (selecting and copying of the text) and LabelControl (transparency), it's possible to inherit the LabelControl and implement the required functionality manually. This example demonstrates how this task can be accomplished.
Question Comments
Added By: Emanuel De Sousa at: 8/12/2014 11:35:13 PM
Does not support HTML Text in the label.
Added By: Alexey Z (DevExpress Support) at: 8/13/2014 1:32:23 AM Hello,To process your recent post more efficiently, I created a separate ticket on your behalf: T139757: Does not support HTML Text in the label. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
How to implement a multi-level footer summaries (Obsolete)
Starting from version 2011 vol 1, this feature is natively supported by the GridView. See the Ability to show several footer summary items for the same columnsuggestion for details.
This example demonstrates how to display more than one summary item under the same column. To implement this you need to handle the CustomDrawFooter and CustomDrawFooterCell events to manually draw footers. Also, you need to manually calculate additional summary within the CustomSummaryCalculate event. Please note that you need to call the GridView.InvalidateRows and the GridView.InvalidateFooter methods to force the GridView to properly repaint itself.
How to implement the drag-and-drop capability to re-order rows and drop them onto an external control
We have implemented GridDragDropManager behavior in the grid extentions library. This attached behavior allows you to include the drag and drop support in your application more easily than the old approach.
This description is actual only for versions earlier than 12.1.:
The following example demonstrates how to implement the drag-and-drop capability to allow end-users to do the following:
1. re-order grid rows;
2. drag any grid row from a grid and drop it onto an external control.
To accomplish this task, it is necessary to set the GridView.AllowDrop property to True and handle its PreviewMouseDown, PreviewMouseMove, DragOver, and Drop events as shown in this example.
Question Comments
Added By: Katya Zhugastrova at: 8/13/2014 7:01:50 AM
Hello! Is the solution the same for DevExpress v.13.1?
Added By: Michael Ch (DevExpress Support) at: 8/13/2014 10:42:46 AM Hello,The ListBoxDragDropManager and GridDragDropManager classes were introduced starting in 12.1. So, you can use this solution for v13.1. In any case, if you face any difficulties, please do not hesitate to contact us. We will be happy to help you.
Thanks,
Michael
How to implement the multi-row editing feature in the ASPxGridView
We already have the E158 example showing how to implement a similar feature. The project below is a simplified version of the same functionality, which allows you to edit all rows on a current page at once. To implement this, I added the ASPxTextBox to the DataItemTemplate Container of several columns and bound these editors to the underlying data source. This will force the ASPxGridView to always display editors in these columns. So, the end-user can input values in these editors. After that click the PostModifications button to preserve the changes made. NOTE, this is done without switching the ASPxGridView to the EditMode and back.
To preserve the changes made, I saved editor values to the List<object> and then used these values by setting the UpdateParameters of the ASPxGridView's DataSource. Finally, to obtain editors and their values, I used the ASPxGridView.FindRowCellTemplateControl Method.
See Also:
How to implement the multi-edit functionality with a multi-page grid that is bound dynamically
Custom client-side logic implementation in the grid with multi-row editing
How to edit multiple selected rows in a single Edit Form
How to force the grid to stay in Edit mode
How to perform ASPxGridView instant updating using different editors in the DataItem template
Question:E324 - How to calculate the ASPxGridView group summaries on the client side
Question Comments
Added By: jdubeau at: 7/17/2012 5:50:48 PM
this example does update anything.
Added By: Wendy Ramsaur at: 7/23/2012 12:57:07 PMHow are you collecting updated information and putting it in to the list? This only updates with the original information.
Added By: yaniv abo at: 7/25/2012 11:16:17 AMwhan you select Run Online the Grid data does not update whan you click "Post Modifications"
Added By: Manish Singh 8 at: 7/30/2012 11:43:03 PM@yaniv abo : you have to provide the KeyFieldName Properties of gridview then this code will work
Added By: Wendy Ramsaur at: 7/31/2012 10:34:47 AMOK, it works...sort of. I have a column represented by a RadioButtonList. The callback is not getting any updated values. Can I get some help?
Added By: Wendy Ramsaur at: 7/31/2012 10:45:12 AMAlso just tried using a textbox. Again, does not get updated values in this example.
Added By: Fiona Titcombe at: 10/18/2012 4:00:21 AMIs there any solution to this? FindRowCellTemplateControl(grid, col, "txtBox") returns the original value, not the updated value.
Added By: Hamdy Nassar at: 10/20/2012 12:44:48 AMthanks alot it is working perfect
Added By: Steve Knowles at: 12/10/2012 10:16:11 AMI am having the same problem as others in that the original, not updated value is being returned. Has anyone figured out why this happens in some projects?
Added By: Ashley Perkins at: 12/18/2012 9:02:33 AMTo anyone having problems with this demo make sure you are not touching the grid view data source on page load.
I was changing the select query and rebinding on page load, this caused the values to reset. Got rid of that and it worked perfectly.
Added By: Bryan Meier at: 1/31/2013 11:36:43 AMTo add on to what Ashley commented on...
Make sure you have the AutoPostBack set to false on the button you are using to perform the callback. By default the value is true which will override your callback and the OnCustomCallback event of your grid will never get called. Not to mention your changes will be reverted back to the original values.
Added By: Prashanthi G at: 9/3/2013 9:19:25 PMIn this given example no.of rows is less and it is working fine, how to achieve this kind of functionality if more no of records more say for ex 100 records. page load became very slow and some times not responding message is coming. Any suggessions
Added By: Philippe Foucart at: 9/24/2013 2:18:37 AMWorks perfect for me on pc, but not on ipad -> on ipad, when clicking the button, nothing happens, I just get the circling image indicating somethings happening in background, but looks like callback is not executed.
any ideas?
I have converted this code to fit my database structure. It looks like everything is coded correctly, but after running through the code to update the database ...
for (int i = 0; i < list.Count; i++) {
AccessDataSource1.UpdateParameters["CategoryName"].DefaultValue = list[i].CategoryName;
AccessDataSource1.UpdateParameters["Description"].DefaultValue = list[i].Description;
AccessDataSource1.UpdateParameters["CategoryID"].DefaultValue = list[i].Id.ToString();
// AccessDataSource1.Update(); << Uncomment this line to update data!
}
ASPxGridView1.DataBind();
The database never gets updated. Any thoughts? The list gets built correctly and contains all the updated data from the grid. Help.
Added By: M Abo Habiba at: 1/6/2014 1:55:28 AMIs this resolved 13.2 as BatchEdit ?
Added By: Paul.Astramowicz@thyssenkrupp.com Paul.Astramowicz@thyssenkrupp.com at: 8/13/2014 12:48:28 PMCan we use this Example somehow but within using it within a FORM<> ???
Custom client-side logic implementation in the grid with multi-row editing
Custom logic implemented in this example allows the end-user to select a limited number of named columns via comboboxes. The maximum number of columns the user can select is defined by a numeric column value, which he can also change. The only callback is used to post the entire grid page data.
To work in multi-row-edit mode, scripts and ClientInstanceName property values are generated programmatically.
See Also:
ASPxGridView - Multi-Row Editing
How to implement the multi-row editing feature in the ASPxGridView
How to perform ASPxGridView instant updating using different editors in the DataItem template
Question Comments
Added By: Paul.Astramowicz@thyssenkrupp.com Paul.Astramowicz@thyssenkrupp.com at: 8/13/2014 1:17:12 PM
How would the below code be used if you were to use a ASPxSpinEdit Instead of a ASPxTextBox ?
How to merge reports in XAF
In the XtraReports documentation How to: Merge Pages of Two Reports article it is described how to merge two XtraReports.
To embed this solution in an XAF application, use the WinReportServiceController.CustomShowPreview event and combine the passed e.Report report with the customized XtraReport1 report:
[C#]privatevoidreportService_CustomShowPreview(objectsender,CustomShowPreviewEventArgse){XtraReport1coverPageReport=newXtraReport1();coverPageReport.CreateDocument();e.Report.CreateDocument();coverPageReport.Pages.AddRange(e.Report.Pages);coverPageReport.ShowPreviewDialog();e.Handled=true;}
Question Comments
Added By: Mario Blatarić at: 12/5/2013 11:39:05 PM
How to do this in 13.2 and ReportsV2?
There isn't e.Report any more ...
A solution for ReportsV2 is provided in the ReportsV2 - Provide the capability to customize reports just before showing them ticket.
How to colorize chart items using the ChartItemArgumentToColorKeyProvider class
The following example demonstrates how to colorize chart items using the ChartItemArgumentToColorKeyProvider class as a color information provider.
For this, create a ChartItemArgumentToColorKeyProvider object and assign it to the KeyValueColorizer.ColorItemKeyProvider property.
Then, create a few ColorizerColorTextItem objects with keys, which represent arguments of chart items, and add them to the colorizer via its KeyValueColorizer.AddItem method.
How to colorize map shapes using the ShapeAttributeToColorKeyProvider class
The following example demonstrates how to colorize chart items using the ShapeAttributeToColorKeyProvider class as a color information provider for the colorizer.
To solve this task, create a ShapeAttributeToColorKeyProvider object. Specify the ShapeAttributeToColorKeyProvider.AttributeName property value as a shape argument name. Assign the object to the KeyValueColorizer.ColorItemKeyProvider property.
Then, add ColorizerColorTextItem objects with keys, which represent attributes of shapes, and add it to the colorizer via the KeyValueColorizer.AddItem method.
How to apply Master Filtering in ASPxDashboardViewer in OLAP mode
In this example, the ASPxClientDashboardViewer.SetMasterFilter method is used to select required cards in the Card dashboard item. This method is called in the ASPxClientButton.Click event handler of ASPxButton1.