How to retain original image URI in HTML document
How to provide custom summary values for Total, Grand Total and ordinary cells for WinForms PivotGridControl
This example demonstrates how to determine the value type when you calculate custom summary values.
1. Set the data field's SummaryType property to Custom to perform calculations manually, by handling the CustomSummary event.
2. Use the PivotGridCustomSummaryEventArgs.ColumnField and PivotGridCustomSummaryEventArgs.RowField properties to determine the kind of a processed cell. You can use the following rules to determine that a cell is being processed:
a. If ColumnField or RowField is null, it means that this is a Grand Total cell;
b. If both ColumnField and RowField are last fields in a corresponding area, this means that this is an ordinary cell.
c. In other cases, this is a Total cell.
See Also
T158425: How to calculate Total cell values based on the low level Cell summary values
Example versions for other platforms:
E2592: How to provide custom summary values for Total, Grand Total and ordinary cells for ASPxPivotGrid
T555636: How to provide custom summary values for Total, Grand Total and ordinary cells for WPF PivotGridControl
How to provide custom summary values for Total, Grand Total and ordinary cells for ASPxPivotGrid
This example demonstrates how to determine the value type when you calculate custom summary values.
1. Set the data field's SummaryType property to Custom to perform calculations manually, by handling the CustomSummary event.
2. Use the PivotGridCustomSummaryEventArgs.ColumnField and PivotGridCustomSummaryEventArgs.RowField properties to determine the kind of a processed cell. You can use the following rules to determine that a cell is being processed:
a. If ColumnField or RowField is null, it means that this is a Grand Total cell;
b. If both ColumnField and RowField are last fields in a corresponding area, this means that this is an ordinary cell.
c. In other cases, this is a Total cell.
See Also
E1877: How to Implement Custom Summary
T158425: How to calculate Total cell values based on the low level Cell summary values
Example versions for other platforms:
T555679: How to provide custom summary values for Total, Grand Total and ordinary cells for WinForms PivotGridControl
T555636: How to provide custom summary values for Total, Grand Total and ordinary cells for WPF PivotGridControl
Question Comments
Added By: Eurofins Lancaster Labs at: 10/12/2012 10:16:06 AM
How can we override the bottom right grand total (total of grand totals)?
Added By: Eurofins Lancaster Labs at: 10/12/2012 11:17:42 AMNevermind, I just had to loop through the items in the drill down data source.
How to detect which element of the Scheduler was clicked
The following example illustrates how you can obtain the appointment under cursor, how to get the time corresponding to the cursor position within the time cell in the Day View, and how to prohibit dragging appointments to the All-Day area. The time under the mouse pointer is displayed in the window's caption.
How to: Drag-and-Drop GridControl Rows to the TreeList
This example demonstrates how to drag-and-drop rows from the Grid Control to the Tree List control. To support drag-and-drop operations within the GridView, set the ColumnViewOptionsBehavior.EditorShowMode property to either MouseUp or Click. This prevents a cell editor from being opened on the MouseDown event, as this event is used for initialization of drag-and drop operations. To allow the Tree List to accept data dropped onto it, set its AllowDrop property to true.
The TreeList.GetDXDragEventArgs method is used to convert drag event arguments to the DXDragEventArgs type. This allows you to get extended drag-and-drop parameters. The following parameters are used in this example:
- DXDragEventArgsDrag.TagetNode - the target node over which the row is dropped;
- DXDragEventArgsDrag.DragInsertPosition - specifies how a node is inserted (as a child, before or after a node, or at the end of the node collection).
The TreeList is bound to a BindingList data source. Nodes are added using the AppendNode method overload, which takes an array of column values as a parameter. The order of values in this array should match the order of the public properties in the data source.
Question Comments
Added By: JJDX at: 8/27/2015 5:07:24 AM
Hello, could you redone your example to not require VS 2015 or VS 2013 ? I think that many of us still use 2012. Thanks :)
Added By: Sasha (DevExpress Support) at: 8/28/2015 4:12:19 AMHi,
I've updated this example. Please test it and let me know if you can run it with VS 2012 now.
How to post values to underlying data properties immediately after changing a cell value
To post values immediately, subscribe to the CellValueChanging event and call the View.PostEditor method.
If you don't want to handle events, check the E4155 - How to make GridControl immediately save changes in a cell after editing example demonstrating how to create a custom helper that does the entire job automatically.
UPDATE: Starting with version 15.1, you can use the DataViewBase.EnableImmediatePosting property to post values to a data source without leaving an edited cell.
How to select all column cells by clicking the column header with the Ctrl key pressed
Implement a TableView descendant. In the descendant, override the OnColumnHeaderClick method. The last step is to call the SelectCell method for the necessary column while iterating through visible rows.
RiaInstantFeedbackDataSource - How to show data from dependent tables
This example shows how to create a new custom View that will include data from two dependent data tables.
One way to solve this task is to create a custom data base View that will include required fields on the server side. It is shown in the RiaInstantFeedbackDataSource - How to show included entity field data in DXGrid using custom DB View Code Central example.
The other way to accomplish this task is to join required data from two tables at the Domain Service level using a custom GetCustomersOrders query implementation.
First, it is necessary to set RiaInstantFeedbackDataSource UseExtendedDataQuery to 'True'. Then, implement the custom GetCustomerOrders and GetCustomerOrdersExtendedData methods. The latter is required to provide the correct RiaInstantFeedbackDataSource work in the extended query mode.
How to provide custom images for checked/unchecked states in CheckEdit
Implement a style for the CheckEdit class. In this style, assign the Template property. The ControlTemplate should include the Image
control. Implement a ControlTemplate trigger. In the trigger change the Source property for the Image control if the check state is checked.
Scaffolded Application (Entity Framework Code First)
Scaffolded Application (Entity Framework Database First)
Scaffolded Application (Entity Framework Core)
How to show parent nodes during filtering when the HierarchicalDataTemplate mode is used
When the HierarchicalDataTemplate mode is used, the TreeListView creates child nodes only when you expand a parent node for the first time. So, the required step in this scenario is to expand all nodes to forcibly create them. To show parent nodes when child nodes are not filtered out, set the TreeListView.FilterMode property to "Extended".
For versions prior to 14.2:
By default, if a child node meets filter criteria but the parent node doesn't, the parent node is hidden. To change this behavior, it is necessary to handle the CustomNodeFilter event and implement filtering logic manually. To check whether or not a node meets filter criteria, use the ExpressionEvaluator.Fit method.
How to Change Tab Background in DXTabControl and Keep the Default Highlight Effects
To change tab background in DXTabControl, use the BackgroundColor property. This property changes the tab background color when it's not active and affects the line color displayed in the tab header when it's active:
If you wish to customize header colors in different states (Selected, Focused, Hover, Normal), use the approach demonstrated at How To: Change the Tab Background in DXTabControl when a Tab is Selected, Focused, or Hovered.
To learn more about appearance customization in DXTabControl, refer to Appearance Customization.
How to deserialize custom properties using the CreateContentPropertyValue event
This example demonstrates how to serialize and deserialize custom properties with a custom type. If a custom property is null when the deserialization process is invoked, it's necessary to handle the DXSerializer.CreateContentPropertyValue event. In the CreateContentPropertyValue event handler, create a new instance of a custom type and assign it to the XtraCreateContentPropertyValueEventArgs.PropertyValue property.
How to use the CollapsedNavPaneItemsSource property to show items in a collapsed NavBar
This example demonstrates how to use the CollapsedNavPaneItemsSource property to show custom items in a group when NavBarControl is collapsed. To generate the items, bind CollapsedNavPaneItemsSource to a collection and set the CollapsedNavPaneItemsTemplate property to visualize items from the collection. To get the currently selected item in a collapsed group, use the CollapsedNavPaneSelectedItem property.
This approach can be used to create a similar NavBar as in Outlook.
How to Cache Views in DXTabControl
When views with heavy elements are displayed in a DXTabControl, it makes sense to cache them so that they are not recreated whenever a tab is opened. This will decrease loading time for cached tabs. DXTabControl supports several cache modes managed by the TabContentCacheMode property:
- CacheAllTabs - all tabs are cached when DXTabControl is shown
- CacheTabsOnSelecting - tabs are cached only after selecting
- None - caching is disabled
How to Create a Navigation Menu with TreeView Similar to Outlook 2003 Using SideBarView
How to format GridControl columns using data attributes and Fluent API
This example demonstrates how to use the following attributes to influence columns generated by the GridControl:
-DisplayFormat
-NumericMask
-DateTimeMask
-RegExMask
You can also use the Fluent API mechanism instead of attributes. Create a class implementing the IMetadataProvider interface. In the IMetadataProvider.BuildMetadata method, assign required metadata:
[C#]voidIMetadataProvider<Customer>.BuildMetadata(MetadataBuilder<Customer>builder){builder.Property(p=>p.ID).NumericMask("N0");builder.Property(p=>p.Name).DisplayFormatString("name is: {0}",true);builder.Property(p=>p.Phone).RegExMask(@"\d{2}-\d{2}-\d{2}");builder.Property(p=>p.HiredAt).DateTimeMask("dd/MM/yyyy");}
To register this metadata, use the following code:
[C#]MetadataLocator.Default=MetadataLocator.Create().AddMetadata(typeof(Customer),typeof(DataAnnotationsElement1Metadata));
With this approach, you don't need to modify the model class code. This may be useful if you don't have access to this class code.
How to adjust Visible Group Headers and Overflow Panel in NavigationPaneView
This example demonstrates how to adjust Visible Group Headers and Overflow Panel in NavBarControl when NavigationPaneView is used.
NavigationPaneView provides the following properties for this purpose:
-IsSplitterVisible. Gets or sets whether the splitter above Visible Group Headers is visible
-IsOverflowPanelVisible. Gets or sets whether the Overflow Panel is visible
-MaxVisibleGroupCount. Specifies the maximum number of visible group headers in the Group Button Panel
-GroupButtonTemplate. Specifies the template applied to items in the Group Button Panel
-OverflowGroupTemplate. Specifies the template applied to items in the Group Button Panel