Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all 7205 articles
Browse latest View live

XtraMap Getting Started - Lesson 3 - Binding a map control to data loaded from XML

$
0
0

This example illustrates how to bind a Map control to data. This data stored in an external XML file, which contains information about wrecked ships, including ship coordinates.

In this example, the map control automatically generates ship images based on data from the datasource, along with a description for each image in a tooltip.

Question Comments

Added By: Stefán Höskuldsson at: 8/21/2013 2:57:31 AM    

In this example below you are always using the same image for each item. If I wanted different images (like based on type of ship) could I somehow use the MapItemAttributeMapping to map to an Image or an ImageIndex in the Ship class?

Added By: Joaquin Corrales at: 5/24/2016 1:27:28 PM    I'm unable to open this download as it asks me to open with VS2015 and then says "this example has not been tested yet". Can you please assist? Added By: John (DevExpress Support) at: 5/25/2016 12:04:51 AM    

Hi Joaquin,
This is a known issue. We are already working on it. You will be notified when it is fixed.

Added By: John (DevExpress Support) at: 5/29/2016 11:04:58 PM    Hi Joaquin,
We have fixed this issue. Try to download and run this example. Added By: Guido Geurts at: 5/15/2018 1:41:06 AM    on this example the xml has 9 rows, but i cannot find any shipwreck on the map. What can be the problem ?
The only thing I changed is the kind to "road"


ASPxGridView - How to edit multiple selected rows in a single Edit Form

$
0
0

This example demonstrates how the grid's standard Edit Form can be used to input and apply identical values to all selected grid rows.

See Also:
ASPxGridView - Multi-Row Editing

Question Comments

Added By: Esteban Rijo at: 4/4/2013 1:09:09 PM    

Necesito un video tutorial PASO A PASO de cómo editar múltiples filas seleccionadas en un único formulario de edición en visual estudio 2010

Added By: Mehul Harry (DevExpress) at: 4/4/2013 1:39:58 PM    

Esteban,

You should be able to use this in VS2010 with the v12.2 release.

Added By: Esteban Rijo at: 4/4/2013 6:34:00 PM    

Soy nuevo en esto, si pudiera explicarme mejor lo agradecería. Tengo un GridView con su datasource le agrego una columna templatefield, y a esa columna le quiero editar valores a todos los registros como lo hace este ejemplo.
y cuando dice version v12.2 a que se refiere

Added By: Mehul Harry (DevExpress) at: 4/5/2013 10:39:57 AM    

Esteban, Please create a ticket in our support center and they can help you. And unfortunately, we only support English language. I recommend http://translate.google.com if you need help with conversion. Thanks.

Added By: Vinanthi Basavaraj at: 5/15/2018 4:27:41 AM    Hi

Why is this example is not available anymore?

How to add a CheckBox column which provides to check/uncheck all CheckBoxes in this column

$
0
0

This example demonstrates how to add a CheckBox to a column header which allows you to check/uncheck all CheckBoxes in cells under this column.

This functionality is implemented by means of a behavior - CheckMultipleBehavior. It should be attached to TableView. CheckBoxes appear in boolean columns for which the CheckMultipleBehavior.ShowHeaderCheckBox attached property is enabled.

To immediately update CheckBoxes' state, the behavior does the following:
1) Subscribes the grid's data source to the CollectionChanged event if supported.
2) Subscribes every item in the grid's data source to the PropertyChanged event if INotifyPropertyChanged is implemented.
3) Subscribes to changing the IsHeaderCheckedProperty attached property. This property can be changed by clicking CheckBoxes in column headers.

Question Comments

Added By: Dan Kelly 2 at: 3/1/2017 9:05:29 AM    Is there a version of this that does not use MVVM?Added By: Andrey K (DevExpress Support) at: 3/1/2017 11:26:25 AM    

Hello,

I've created a separate ticket on your behalf (T488150: Is there a version of T169119 that does not use MVVM). It has been placed in our processing queue and will be answered shortly.

Thanks,
Andrey

Added By: Paul Trep at: 5/15/2018 1:38:50 PM    This example works well, but I need to make the header's multi-check checkbox readonly when the grid is read only.  Is there a way I can do this?

XRTable - How to best fit columns

$
0
0

Currently, XRTable does not provide the best fit column functionality for several reasons. It is not quite clear how this feature should work in the case of multi-line text in cells. Being applied to a grid, the best-fit feature resizes grid columns so you can use the horizontal scrollbar to reach all of them. Reports does not provide interactivity like content scrolling and it is difficult to foresee how a user would want to change the report layout in the case of large column content. 

For these reasons, a generic solution is not always possible. However, we can implement this manually if required. This example demonstrates how to do so. 

Here are implementation details.
1. Create a document by using the Report's CreateDocument Method.
2. Iterate through all report bricks to obtain the maximum text width within a certain column.
Since XRTable rows act independently and know nothing about each other, to detect the max width of the text in a certain column, we need to iterate through report table bricks manually (for instance, using BricksIterator) and calculate the text width (using the PrintingSystem.Graph.MeasureString method).
3. Re-set the XRTableCell's WidthF property according to calculation results.
4. Re-create the report document.

See also:
How to set the label width so that it is always equal to its text (AutoWidth)
Customizing row height at runtime to a maximum best fit value

Question Comments

Added By: Torsten at: 5/17/2018 2:58:13 AM    How does this work if one also has headers (typically in additional band, like the ReportHeader containing a secondary xrTable with identical number and widths of columns).
Width of header and value cells would have to be synchronized in some way.

Can you extend your sample?

Thanks in advance.

GridControl - How to add a check box to a column header

$
0
0


This example demonstrates how to add a check box to a column header.


Pic. 1


Pic.2


To use this solution in your application, execute the following steps:

1. Drop the GridViewColumnHeaderExtender component onto the target form.
2. Assign GridView to this component.



Description

GridViewColumnHeaderExtender provides the DrawCheckBoxByDefault property. Set this property to true to make check boxes always visible (as shown in Pic. 1).  If you wish to hide these check boxes and show a check box only when the cursor is above a column, set this property to false (Pic. 2).

When a column is checked / unchecked, the GridViewColumnHeaderExtender.ColumnCheckedChanged event is raised. You can handle this event in order to notify related objects of this change. The event handler receives an argument of the ColumnCheckedChangedEventArgs type containing data related to this event. 

See also:
How to add a custom button to a column header in a grid
GridView.CustomDrawColumnHeader Event

Question Comments

Added By: Xingqiang Wang at: 5/17/2018 3:19:37 AM    Thank you very much!
In my version of DevExpressComponents-16.1.12, did I not find the GridViewColumnHeaderExtender component? Is it available in the advanced version? 

How to display documents from the Report and Dashboard Server in the Web Document Viewer

How to display multiply summaries in the same column

$
0
0

This example demonstrates how to display multiply summaries in the same column both in group and total footers.

Question Comments

Added By: Alejandro Cruzado 1 at: 5/17/2018 11:42:51 AM    Hi,
Will the ability to display multiply summaries in the same column be available as a built-in feature in future versions?
 

GridView - How to define calculated fields in the Server Mode

$
0
0

In this example, we demonstrate how you can implement calculated fields when the GridView extension is bound to a Server Mode data source.

On the side of the SQL server, you need to use a Table-Value function and implement all calculated fields there. See the How to define calculated fields in the Server Mode for the GridView control KB article where we described this approach in greater detail.

In the provided GridView extension, only the following fields come from the [Products] table as-is: [Id], [ProductName], [ProductionDate], [ProductPrice], [UnitsInStock]

Other fields are calculated in the following manner:

  Product Expires Date

  This field is calculated on the SQL server side based on the value passed into the SQL function and the value in the [ProductionDate] field.

 DATEADD(day, @daysExpiresOffset, ProductionDate) as ProductExpiresDate

  Days Until Expires

  This field is calculated on the SQL server side based on the current date value passed into the SQL function and the value in the [ProductExpiresDate] field.

 DATEDIFF(day, @currentDate, p.ProductExpiresDate) as DaysUntilExpires

  Product Stock Sum Price

  This field is calculated using the built-in Criteria Language Syntax based on the values of the [ProductPrice] and [UnitsInStock] fields. See the Criteria Language Syntax and Unbount Expressions documentation articles to learn more about this approach.

settings.Columns.Add(col => {
    col.FieldName = "ProductStockSumProce";
    col.UnboundExpression = "[ProductPrice] * [UnitsInStock]";
    ...
});

WPF dashboard - How to manage dashboard parameters in code

$
0
0
This example shows how to override an initial or user-defined dashboard parameter value by changing it in the DashboardControl.CustomParameters event handler. The effective parameter value is hidden from the end-user, and if you set the DashboardParameter.Visible property to false, the parameter itself will also be hidden.

To accomplish this task, a parameter named parameterState is added to the dashboard. It has a default value and a list of values to display in a look-up editor. Those values are displayed in a Dashboard Parameters dialog and can be changed by the end-user.
However, by handling the DashboardControl.CustomParameters event, we can validate the parameter value and ignore the value provided by the end-user. To accomplish this, source data is filtered using a parameterState parameter.The value of this parameter is changed at runtime by handling the DashboardControl.CustomParameters event which is raised before the dashboard sends a query to a database. Thus, only the value passed in the DashboardControl.CustomParameters event is in effect.

How to integrate Snap reports in XAF WinForms

$
0
0

Scenario
This example demonstrates one possible way of integrating Snap reports in an XAF WinForms application. It contains the Snap module (the SnapModule class library) implementing this functionality and the SnapExampleXpo and SnapExampleEF projects demonstrating how to use this module with XPO and EF.

The example integration shows how to store reports layout in business objects and show a list of these objects, as this is done in the built-in Reports module. The main tool for working with these reports is a custom Snap designer form. Underlying business objects can be configured using custom buttons from this form. It is also possible to show a read-only preview form using corresponding actions.



Note that the Snap module from this example is not a part of the standard XAF delivery and is not tested as intensively as our built-in modules. Feel free to modify and test it further according to your business requirements.
If your clients require other scenarios of integrating the Snap reports, please describe them here or in the Create a Snap Report Module for XAF ticket. Thank you in advance!


Steps to implement
The Snap module contains a custom SnapDesigner form and classes used to integrate this form in an XAF application - business classes for storing reports and controllers used to show the designer and preview forms. To learn more about integrating custom forms and controls, refer to the Using a Custom Control that is not Integrated by Default topic.

To see how the module works, download the example and launch the SnapExample.Win or SnapExampleEF.Win project. To create a new Snap document, navigate to the Reports navigation item and click New. A Snap designer will be opened (see the screenshot above). It contains several custom commands implemented especially for XAF:


  New - creates a new Snap document;
  Save - saves changes to the database. If the report is new, shows a DetailView allowing to define document's properties;
  Add XAF Data Source - shows a DetailView allowing to define a new data source. Adds this data source to the current Snap document;
  Edit Object - opens a DetailView of the current IDocumentData object that stores report's settings in the database. Use this button to remove or change the existing XAF data sources or other report's properties.

To see information about built-in Snap designer's commands and learn more about Snap reports, refer to Snap documentation.

To use the Snap module from this example in your application, perform the following steps:

1. Download the example and build it with your version of our components.
2. Copy the DocumentData and DocumentDataSource classes from the example to your application's business classes module (YourSolutionName.Module). If you are using EF, copy classes from the SnapExampleEF\BusinessObjects folder. If you are using XPO, copy classes from the SnapExample.Module\BusinessObjects folder.
3. Add a reference to the SnapModule assembly to your project (YourSolutionName.Win).
4. Add SnapModule to your application's Modules list. To do this, either open the WinApplication.cs file of the YourSolutionName.Win project and add a SnapModule instance to the Modules collection in a constructor, or add the SnapModule project to your VS solution and drag & drop the Snap module from a toolbox in the Application Designer.
5. Set SnapModule's DocumentDataType property to the DocumentData type you have created in step 2.

How to export Scheduler appointments in Google Calendar

$
0
0

This example demonstrates how you can use the Google Calendar API in your scheduling application. Google provides the corresponding guidelines regarding use of this API:
Google Calendar API 

Before using this API, make certain you have read and understand Google’s licensing terms. Next, you’ll need to generate a corresponding JSON file with credentials to enable the Google Calendar API.

We have a corresponding KB article which contains step-by-step description on how to generate this JSON file:
How to enable the Google Calendar API to use it in your application

After you generate this JSON file and put it in the Secret folder of this sample project, you can export appointments to a Google calendar.
1. Click the "Connect" button to generate a list of available calendars for your Google account and load Google events to the SchedulerControl from the selected calendar.
2. Add or change an appointment in the SchedulerControl. The modified appointment will be exported to the Google Calendar.



P.S. To run this example's solution, include the corresponding "Google Calendar API" assemblies into the project.
For this, open the "Package Manager Console" (Tools - NuGet Package Manager) and execute the following command:

Install-Package Google.Apis.Calendar.v3
Install-Package NodaTime -Version 1.3.1 

How to implement a custom inplace editor for appointments

How to implement drag-and-drop appointment functionality between two SchedulerControls

$
0
0

By default, the drag-and-drop appointment functionality between two SchedulerControls is supported.

However, SchedulerControl always removes an appointment after moving it to another SchedulerControl. 
Nevertheless, it is possible to implement this behavior manually by handling the AppointmentDragAppointmentsChanged andAppointmentDeleting events, and preventing appointment deletion in the AppointmentDeleting event handler.

Take special note that both SchedulerControls should have the same mappings to custom fields to prevent losing data from these fields after moving an appointment.
Thus, it's necessary to set custom field mappings for the storages manually using the SchedulerStorage.Appointments.CustomFieldMappings.Add method.

How to paint a special time area for an appointment and interact with it

$
0
0

This example illustrates how to paint a special time area for an appointment by using the CustomDrawAppointmentBackground event. An end-user can move an appointment into this time area, but can't move an appointment out of it.

The time area can be specified by an appointment's custom fields.

How to preserve the Legend checkbox item state in an ASP.NET MVC application

$
0
0
NOTE. Starting with v17.1, you can optionally save legend checkbox state for the chart's Series collection on callbacks. To activate this feature, enable the SaveStateOnCallbacks option.
It is no longer necessary to use the approach shown in this example and save the Legend state manually. All you need is to enable the SaveStateOnCallbacks property.

Chart extension does not cache information about the Series item state when the Legend checkbox feature is enabled. In this situation, it is required to handle the ChartControlSettings.BoundDataChanged event to restore the Legend item checkbox state. This example illustrates how to save the Legend state into a Session variable using the ChartControlSettings.LegendItemChecked event and then restore it on subsequent page requests.

See also:

How to preserve the Legend checkbox item state when the Series collection is initialized programmatically;
How to preserve the Legend checkbox item state when the Series Template approach is used to generate the Series collection.

How to customize the Edit Appointment Form in the "Shared Resources" scenario

$
0
0

This example illustrates how the appointment editing form with multiple resources selection can be implemented in a project with ASPxScheduler control bound to SQL Server.

The CarsXtraScheduling.sql file contains the data table script used to create a sample data table at the SQL server.

To switch the scheduler to multi-resource mode, the Resource Sharing property is set to true. A custom appointment editing form is implemented and the appointment field mapping for the ResourceIds property is specified.

Note: starting from the v2009 vol.2 release the standard appointment form contains an ASPxListBox control which provides the required functionality for assigning multiple resources.
For ASPxScheduler releases prior 9.2, the following workaround is used.
A custom appointment editing form contains a data-bound control with multiple selection capability. The control is based on a combination of ASPxCheckBox and ASPxHiddenField controls, enclosed into a Repeater control template.

How to create a custom exporter using XtraReport (AutoRowHeight, BestFit and FitToPage)

$
0
0

This is an ASP version of the How to create a custom exporter for the PivotGridControl by using the XtraReport suite example that implements following suggestions:
S130430: Support word wrap when printing and exporting
S91257: Utilize a Line color when printing
AS9011: Print row headers on every page on export/printing
and the S18650: Add an event that allows to provide custom size for field values (MeasureFieldValue, or so)  suggestion for printing facilities.

UPDATED:
We implemented the PrintRowAreaOnEveryPage option starting with version 18.1. Please refer to the "Print Row Headings on Every Page" section of the What's New v18.1 article for more details.

Question Comments

Added By: Vijay Macha at: 8/19/2014 7:19:47 PM    

Hi
Can we export the piviotgrid exactly how it is displays in the page(with band columns).

Thanks,
Vijay

Added By: Constant (DevExpress Support) at: 8/20/2014 12:09:49 AM    I do not see a way to accomplish this task and support other important features: AutoRowHeight, BestFit, FitToPage etc.

ASPxGridView - How to save a focused row index to cookies on the server side

$
0
0

The ASPxGridView does not save a focused row in cookies. However, you can add this capability by saving and restoring a focused row index to/from the cookies manually. If the ProcessFocusedRowChangedOnServer property is "true", changing of the focused row is processed on the server side. Thus, it is necessary to save and restore the focused index on the server side:

[C#]
protectedvoidgridView_FocusedRowChanged(objectsender,EventArgse){ASPxGridViewgrid=senderasASPxGridView;Response.Cookies[grid.ID]["FocudedIndex"]=grid.FocusedRowIndex.ToString();Response.Cookies[grid.ID].Expires=DateTime.Now.AddDays(1d);}protectedvoidgridView_DataBound(objectsender,EventArgse){ASPxGridViewgrid=senderasASPxGridView;if(!IsPostBack)if(Request.Cookies[grid.ID]!=null)grid.FocusedRowIndex=Convert.ToInt32(Request.Cookies[grid.ID]["FocudedIndex"]);}

SeeAlso:
ASPxGridView - How to store a focused row index in cookies

How to pass a dashboard parameter to a calculated field's expression in code

$
0
0

The following example demonstrates how to create a new dashboard parameter and pass it to a calculated field's expression.


In this example, the dashboard connects to the Northwind database and selects data from the 'SalesPerson' table. A new calculated field evaluated at a summary level returns 'TRUE' or 'FALSE' depending on whether or not the average discount exceeds the selected parameter value.

OBSOLETE - How to override properties of business objects (Example)

Viewing all 7205 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>