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

How to customize TrackBarControl


How to use the Appointment Split tool

$
0
0

This example illustrates the use of a new tool allowing end-users to split an appointment in two by simply dragging a splitter line.
To accomplish this, use the DevExpress.XtraScheduler.Commands.SplitAppointmentOperationCommand class. Associate this command with the popup menu item in the PreparePopupMenu event handler using the SchedulerMenuItemCommandWinAdapter. After that all you have to do is select the Split command from the appointment's context menu, drag the splitter to the required time and click the left mouse button. You can use the mouse wheel to adjust the splitter precision.

See Also:
How to use an appointment split tool

ASPxGridView - How to hide the EditForm editor and column caption programmatically

How to implement custom field editing via ASPxComboBox

$
0
0

This example demonstrates how to use ASPxComboBox in case of a custom field editing on a custom appointment form. This control (ID="edtField1") is defined in the ~/CustomSchedulerForms/CustomAppointmentForm.ascx markup. The actual databinding (with a lookup logic) is handled in its Init event. The selected value is transfered back to the controller in the CustomAppointmentSaveCallbackCommand.AssignControllerValues method.

This example also illustrates how you can implement and use the IsAppointmentChanged method within your custom AppointmentFormSaveCallbackCommand descendant. The AppointmentFormSaveCallbackCommand.CanContinueExecute method is overridden so that the end-user should change the appointment's Price field to save an appointment. Otherwise any changes are not saved.

Prior to running this example, create a CarsXtraScheduling database on your local SQL Server instance. The database script is attached to the project (CarsXtraScheduling.sql file). You should modify the script to include the correct database path.

See also:
How to modify the appointment editing form for working with custom fields (step-by-step guide)

How to implement a custom LookUpEdit supporting Server Mode

$
0
0

The current LookUpEdit version does not allow using Server Mode datasources. This example demonstrates how to create a custom editor that allows using them.

Question Comments

Added By: Andrew Thornton at: 7/19/2013 10:32:51 AM    

Hi,

Just upgraded to 13.1.5, and this no longer compiles. Quite a few undocumented things looked to have changed.
Can we have a 13.4/5 version that works please?

Thanks.

Added By: Justin Zeng at: 4/17/2014 4:32:51 AM    

It seems many problem, can this function to be support in new version ?

Added By: Ivan (DevExpress Support) at: 4/27/2014 10:42:28 PM    

Hi Justin,

We cannot guarantee that this functionality will be available in the latest version. For now, you can try to extend this example manually. If you face difficulties doing this, do not hesitate to contact us.

How to use a combo box whose choices are different for each cell in the grid

$
0
0

There are two ways to accomplish this task: via filter criteria and by using a multibinding approach. Let me explain theses approaches in detail.


1) Filter criteria

The main idea is to dynamically construct a filter by using the selected value of the first column in the grid. So, items in the ComboBox editor will be filtered automatically according to the filter's value. In this case, it is necessary to create a converter (which implements the IValueConverter interface) in the code-behind file.


2) Multibinding approach.
You can also resolve this problem by using the multibinding approach. Specify multiple bindings in a MultiBinding object and create a converter (which implements the IMultiValueConverter interface) to produce a final value for the binding target property based on values of those bindings.

Question Comments

Added By: XempleX at: 4/5/2013 1:10:41 AM    

The problem with this solution is that the ItemsSource is used by all the rows in the grid. This means that, if you've already selected a colour for "Make1", then while you're selecting a colour for "Make2", the colours in the "Make1" rows disappear! In fact, in the example below, they never reappear because the HiddenEditor event hasn't been handled. So this solution is only useful when you only have a single "Make" in the grid (which means that it isn't really useful at all).

Added By: Elliot (DevExpress Support) at: 4/16/2014 12:54:00 AM    

Please accept my sincere apologies for the delayed response. I re-created this code example in November, 2013. Currently, this code example works correctly for this situation. You can download the new version of this code example from our website and check it. If you experience any further difficulties, do not hesitate to contact us again. We are here to help you.

How to implement running total using ASPxGridView

$
0
0

This example demonstrates how to implement a running total summary using the ASPxGridView unbound column. In this example, we create an unbound column and handle the ASPxGridView.CustomUnboundColumnData event. We calculate and assign the value to the cell on the server side.

How to display a login view as a popup window during navigation between views

$
0
0

This approach can be applied starting with 13.2.9

This example demonstrates how to check whether the user is logged in and display a login view when it is necessary during navigation.

It is necessary to perform the following steps to accomplish this task:

1. Add a new view and place a dxPopup in it.

2. Implement the required logic for this view in a corresponding view model.

3. Handle the HtmlApplication.initialized event. In this event handler, get the login view template using the HtmlApplication.getViewTemplate method and add the view to the view port. This will allow you to display its internal popup using options from its view model.

4. Bind the login view model to the view markup using Knockout.

5. Declare a global variable for determining when a user is logged in. In this example we set this option to false by default, and we will set it to true when a user is logged in. This variable can be accessed from any part of the application and we can change its value in the login view model.

6. Handle the HtmlApplication.navigating event. In this event handler, we can get a view info (see HtmlApplication.getViewTemplateInfo) for the navigated view and check user credentials if necessary. For this purpose, we added the secure option to those views that should not be displayed for unauthorized users. If the user unauthorized, we can call a method from the login view model to display dxPopup from the login view. Moreover, you can cancel navigation by setting the cancel parameter of the event handler to true.

See also:
How to send authenticated requests to the OData service

Question Comments

Added By: Alexandre Henriques at: 4/28/2014 7:36:44 AM    

How do I make this piece of code in version 13.2.7?

app.initialized.add(function() {
       var $view = app.getViewTemplate("LogOnPopup");
       $view.appendTo(".dx-viewport");
       LogOnAsPopupView.loggedOn = ko.observable(false);
       LogOnAsPopupView.logOnPopupViewModel = LogOnAsPopupView.LogOnPopup();
       ko.applyBindings(LogOnAsPopupView.logOnPopupViewModel, $view[0]);
   });

Added By: Nikolai (DevExpress Support) at: 4/28/2014 11:00:20 PM    Hi Alexandre,

I have created a separate ticket for this issue. Please post comments to the How to display a login view as a popup window during navigation between views (13.2.7) ticket.

How to create a Nested Donut chart

$
0
0

The following example demonstrates how to create a Nested Donut chart.
To do this, it is necessary to assign the ChartControl.Diagram property to SimpleDiagram2D, and then add two NestedDonutSeries2D objects with points to the diagram's Diagram.Series collection.
Also, this example shows how to change the color of each series point according to its values using the ChartControl.CustomDrawSeriesPoint event. As a result, segments of an outer donut representing kinds of products are colored with a specific Product group color (an inner donut).

How to implement a conditional summary for grouped columns in ASPxGridView

$
0
0

This code example demonstrates how to implement a conditional summary for grouped columns. In this example, an ASPxGridView is created with two grouped columns, a custom summary is set for the UnitsInStock column and the ASPxGridView.CustomSummaryCalculate event is handled. The summary is calculated depending on the Discontinued column.

How to display check boxes for legend items, to control the visibility of series

$
0
0

This example demonstrates how you can accompany each legend item with a check box, which controls the visibility of the corresponding series (obsolete approach).

Note that starting with the DXperience version 13.2.1, the chart control supports a built-in check box in the Legend feature. For more details, see the Legend Check Box topic.  

How to display check boxes for legend items to control the visibility of series in the unbound mode

$
0
0

This example demonstrates how you can provide each legend item with a check box, which controls the visibility of the corresponding series in the unbound mode.
Note that starting with the DXperience version 13.2.1, the chart control supports a built-in check box in the Legend feature. For more details, see the Legend Check Box topic.  

Implementation details for the DXperience v2012 vol 2.5

To accomplish this, it is necessary to assign the Legend.Template property to custom template and then bind the ItemsSource property of the ItemsControl object to SeriesNonVisualWrappersCollection.

This custom collection is synchronized with the diagram's series collection when the SeriesCollection.CollectionChanged event fires.

In addition, the fake series is created to avoid hiding the legend when the Series.Visible property is set to false for all series.

See also:
- How to display custom information in the legend;
- How to customize chart titles;
- How to display check boxes for legend items, to control the visibility of series in the bound mode.

How to emulate an editable GridLookUpEdit with PopupContainerEdit

$
0
0

This example illustrates how to implement an analog of GridLookUpEdit that allows editing of GridControl data. The following approach is used: create a PopupContainerEdit, assign a panel to PopupContainerControl by setting the PopupContainerEdit.Properties.PopupControl property and then add GridControl to it. For synchronizing PopupContainerEdit's value and display text with the state of controls residing within the popup window the PopupContainerEdit.QueryResultValue and PopupContainerEdit.QueryDisplayText events were used.

Question Comments

Added By: Thomas Ferdinand at: 4/2/2014 7:40:08 AM    

Hi,
there is a problem: If you edit a value (fruit) and click outside the grid, the popup is corectly closed but the edited value is not applied.
Any ideas how to fix this?

Best regards, Tom

How to draw custom marks in the RichEditControl for WPF

$
0
0
This example illustrates the technique for creating and visualizing custom marks within the document. The CreateCustomMark method is used to add a mark to the document. The  mark is visualized by drawing a rectangle in the CustomMarkDraw event handler.

How to display check boxes for legend items to control the visibility of series in the bound mode

$
0
0

This example demonstrates how you can provide each legend item with a check box, which controls the visibility of the corresponding series in the bound mode (obsolete approach).
Note that starting with the DXperience version 13.2.1, the chart control supports a built-in check box in the Legend feature. For more details, see the Legend Check Box topic.  

To accomplish this, it is necessary to assign the Legend.Template property to custom template and then bind the ItemsSource property of the ItemsControl object to SeriesNonVisualWrappersCollection.

This custom collection is synchronized with the diagram's series collection when the SeriesCollection.CollectionChanged event fires.

In addition, the fake series source is created in the chart's data source to avoid hiding the legend when the Series.Visible property is set to false for all series.

See also:

- How to display custom information in the legend;

- How to display check boxes for legend items to control the visibility of series in the unbound mode

Question Comments

Added By: Aleksei Smirnov at: 4/28/2014 8:44:38 AM    

Hello,
thanks for a very good example. It is really useful. However it is not working as expected. The color in the legend is not the same as the color in the chart in cases when visibility is changed.

The reason is that chart is uses palette only for visible elements. I mean if only one series is visible it would be always the same color independently on the series type. For example, if Series2 is the only visible series it is red. If Series1 is the only visible it is red too! When I make Series1 invisible, Series2 changes it's color from Green to Red. Legend still shows the original colors!

Could you please suggest the way how to disable such behavior? I don't want the series to change their colors if amount of visible series are changing.

Thanks

Added By: Eugene M (DevExpress) at: 4/28/2014 11:24:14 PM    

Hello, Aleksei
Can you please clarify what version of DevExpress product you are using?

Added By: Aleksei Smirnov at: 4/29/2014 12:45:35 AM    

Hello Eugene,
I am using DevExpress 13.2_9

Added By: Eugene M (DevExpress) at: 4/29/2014 5:40:24 AM    

I'm happy to inform you that we have a built-in check box in the Legend feature starting from the 13.2.1 release. Please refer to the Legend Check Box topic.

Added By: Aleksei Smirnov at: 4/29/2014 6:54:10 AM    

Thanks, Eugene. Good news!


How to draw custom marks in the RichEditControl for Silverlight

$
0
0
This example illustrates the technique for creating and visualizing custom marks within the document. The CreateCustomMark method is used to add a mark to the document. The  mark is visualized by drawing a rectangle in the CustomMarkDraw event handler.

ASPxGridView - How to set a different color for the modified cell in different columns in Batch Edit mode

$
0
0

To implement this scenario, handle the HtmlDataCellPrepared event and add a custom attribute for each data cell:

     

[C#]
protectedvoidGrid_HtmlDataCellPrepared(objectsender,ASPxGridViewTableDataCellEventArgse){e.Cell.Attributes.Add("fieldName",e.DataColumn.FieldName);}

Then, you can change the cell's color by modified the dxgvBatchEditModifiedCell CSS class based on the "fieldName" attribute of each cell:

[CSS]
.dxgvBatchEditModifiedCell[fieldName="C2"]{background-color:LightCoral!important;}.dxgvBatchEditModifiedCell[fieldName="C3"]{background-color:LightYellow!important;}.dxgvBatchEditModifiedCell[fieldName="C4"]{background-color:LightBlue!important;}.dxgvBatchEditModifiedCell[fieldName="C5"]{background-color:LightSalmon!important;}
Question Comments

Added By: Yahya Ali at: 4/29/2014 7:52:33 AM    

impressive! but needs some documentations to get the full idea.

How to implement the basic idea of the Microsoft Word "Format Painter" feature for RichEditControl

$
0
0

This example demonstrates how to copy the characters and paragraphs properties and apply formatting to the selected text. Try the Format Painter button on the ribbon Home tab.


To obtain the selected text range, the RichEditDocument.Document.Selection property is used. The characters and paragraphs properties are obtained in the BarCheckItem.CheckedChanged event handler. Then, they are stored in the CharacterPropertiesObject and ParagraphPropertiesObject object containers.


In order to change the current RichEditControl cursor, a MouseCursorCalculator descendant is implemented. Check the custom MouseCursorCalculator class Calculate method for clarification.

ASPxGridView - How to disable editing for rows that match some condition in Batch Edit Mode

$
0
0

This example demonstrates how to disable editing for rows, whose discontinued value is true. In this example, ASPxGridView is created with ASPxGridView.SettingsEditing.Mode = "Batch" and the ASPxGridView.HtmlRowCreated event is handled. For each cell in a row whose discontinued value is true, an attribute that cancels a click is added.

RibbonControl - How to implement the SaveLayoutToStream / RestoreLayoutToStream methods

$
0
0

This example illustrates how to save the RibbonControl layout to a stream and when to restore it.

Viewing all 7205 articles
Browse latest View live


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