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

How to create a PropertyEditor based on the XtraRichEdit control

$
0
0

Take special note that this editor is intended to be used for a simple and most common scenario when only one text property in a Detail View is edited with the help of the XtraRichEdit control (RichEditControl). Other scenarios are not supported in this example and are required to be implemented manually. For example, if there are more than one property, edited with this editor in a Detail View, then there may be problems with merging in ribbons. See the B142856 issue for more detailed information.


See Also:
Implement Custom Property Editors
How to: Implement a Property Editor for Windows Forms Applications
XtraRichEdit Home
PropertyEditors - Support the XtraRichEdit control.

Question Comments

Added By: Willem de Vries at: 10/24/2012 7:25:46 AM    

After copying the necessary files to my project, i ran into an error in MergeRibbonDetailViewController. I changed the code slightly (in the test):

        private void Frame_TemplateChanged(object sender, EventArgs e) {
            UnMergeRibbon();
            mainRibbonControl = null;
            IClassicToRibbonTransformerHolder form = Frame.Template as IClassicToRibbonTransformerHolder;
            if (form != null && form.RibbonTransformer != null) {
                form.RibbonTransformer.Transformed += RibbonTransformer_Transformed;
            }
        }


How to bind a GridControl to a DataTable

How to sort Appointments with the same time interval

$
0
0

This example illustrates how to sort Appointments with the same time interval. This can be useful if you wish to sort all-day appointments (or daily appointments with the same Start and End values) by your custom rule.

This functionality may be introduced by implementing a custom DevExpress.XtraScheduler.Services.Internal.IExternalAppointmentCompareService service.

Question Comments

Added By: Marvin Dongen at: 4/10/2014 4:09:04 AM    

Can I also get an example how to implement this in ASP.NET?

Added By: Stijn Vandenbroucke at: 6/15/2015 12:21:40 PM    

Is there any possibility to perform this on all appointments? And not only on those with 'same time interval'?

Best regards,
Stijn.

Added By: Oleg (DevExpress Support) at: 6/16/2015 2:13:33 AM    

Hello Stijn,
By default, SchedulerControl sorts appointments by their time interval (the start and end dates). Only for appointments with the same start and end time, you can specify a custom sort algorithm. There is no capability to customize the sort order for appointments in case at least one of these dates is different. We have plans to provide more extended capabilities to customize the appointment layout (including the location of appointments within a time cell) in the scope of the following thread:
Provide a way to define a custom appointment layout
However, we have not yet decided when it will be implemented. Thus, at present we can't suggest any solution to customize the appointment sort order in case appointments have different start or end dates.

How to customize a data store schema for SQL data sources

$
0
0

This example demonstrates how to customize a data store schema for a dashboard data source that uses a connection to the Northwind database.


In this example, the IDBSchemaProvider interface is implemented by a class that defines a custom data store schema. The GetSchema method returns tables and columns which will be included to a data store schema.


To see the result, edit the existing query.

Question Comments

Added By: Mariusz Muszalski at: 2/16/2015 3:31:54 AM    

I use ConfigureDataConnection event to provide connection details for my dashboard designer. The data source is OLAP (tabular). Can I use solution above to customize names of fields in field chooser?

Added By: Andrew Aks (DevExpress) at: 2/16/2015 5:29:48 AM    

This approach can be used only for SQL data sources. We will update the Provide a way to localize OLAP cube structure in Dashboard Designer request when a similar capability is added for OLAP data sources.

Grid for Xamarin - Getting Started

How to customize Field Values style via the ASPxPivotGrid.HtmlFieldValuePrepared event

$
0
0

This example demonstrates how to use the ASPxPivotGrid.HtmlFieldValuePrepared event to customize the appearance of a specific Field Value.

BTW: This event was introduced in the ASPxPivotGrid version 10.1, according to the Implement the HtmlCellPrepared and HtmlFieldValuePrepared events suggestion.

Question Comments

Added By: Vincent Harvey at: 6/16/2015 7:51:33 AM    

I tried this :

   Protected Sub pgTestNewSheet_HtmlFieldValuePrepared(sender As Object, e As PivotHtmlFieldValuePreparedEventArgs) Handles pgTestNewSheet.HtmlFieldValuePrepared
       If Object.ReferenceEquals(e.Field, fieldLate) Then
           If (e.Value.ToString() = "Y") Then
               e.Cell.Style(HtmlTextWriterStyle.BackgroundColor) = ColorTranslator.ToHtml(Color.Red)
           End If
       End If
   End Sub

But in the first "If", e.field gave me "" so it didn't go to the second "If".
Can you help me?

Added By: John (DevExpress Support) at: 6/16/2015 11:56:08 PM    Hi Vincent,
I have created a separate ticket for your question: How to customize Field Values style via the ASPxPivotGrid.HtmlFieldValuePrepared event when e.field is empty let's continue the conversation there.

How to update external references in the loaded workbook.

$
0
0
When the SpreadsheetControl loads a workbook containing external references, they are added to the IWorkbook.ExternalWorkbooks collection. However, the external references, created in this manner, are not "live". The references contain cached data and the SpreadsheetControl cannot update them.
To make a reference updateable, it should be replaced with a reference to a workbook instance.
Note that the use of the Workbook class instance in production code requires a license to the DevExpress Document Server or the DevExpress Universal Subscription.

This example demonstrates how to accomplish this. To create a workbook instance, load a workbook file into an instance of the Workbook class (or into another SpreadsheetControl instance).
Subsequently the ExternalWorkbookCollection.Replace method is used to replace the cached reference with a live external reference.
Note that a workbook name in the external reference should be identical to the WorkbookSaveOptions.CurrentFileName property of the referenced workbook instance when the workbook is added to the ExternalWorkbookCollection. That is, if the workbook instance is created by loading a file using a full path, the reference should contain the full path, e.g. 'C:\Temp\[Book1.xlsx]Sheet1'!B3. The string with the reference created in this manner might be too long and inconvenient in use. The Workbook.Options.Save.CurrentFileName property of a referenced workbook enables you to specify a name that is easier to read, for example, "MyExternalWorkBook". Replace the corresponding item of the ExternalWorkbookCollection with an instance of the workbook with a custom CurrentFileName, and use it in external references instead of the file name, e.g.  [MyExternalWorkBook]Sheet1!B3.

ASPxCardView - Search Panel - How to highlight the text placed inside the DataItem template

$
0
0
By default, search results contained in templates are not highlighted. This example illustrates how to highlight them manually. The main idea is that it is necessary to wrap the found text in a span tag with the "dxcvHL" class.

Note: This is a basic example that illustrates how to process simple requests. If you create a composite criterion, it is necessary to perform additional operations to parse the search text.

Report Server - How to get the list of available reports and display a report preview in a Windows Forms application

$
0
0

The sample demonstrates how to use the Report Server WCF API in a Windows Forms application.

Question Comments

Added By: Juan Carlos Cabrera 1 at: 4/21/2014 5:13:55 PM    

Hello!!... I have a question... What is ReportViewerForm?. Thanks

Added By: Igor D (DevExpress) at: 4/22/2014 1:22:12 AM    

Hi!
 
ReportViewerForm, as the name suggests, is a form with the DocumentViwer control. Please download the example to see the full source code.

Added By: Juan Carlos Cabrera 1 at: 4/22/2014 8:35:33 AM    

ooohhh!!... very good... it ́s great. Thanks

How to create an effect of a banded TreeList

$
0
0

The current version of the TreeList doesn't support bands. This example demonstrates how you can merge column headers to create an effect of bands.

Question Comments

Added By: (no info) at: 4/5/2013 3:46:56 PM    

Where is TreeListHeaderMerger method defined?

Added By: Sarath Kumar Munikrishnan at: 6/18/2015 12:31:16 AM    

HI I need to merge Columns also. Not the header. I used following code change in the below code

public class TreeListHeaderMerger
   {
       private TreeList treeList;
       private TreeListColumn columnToMerge;

       public TreeListHeaderMerger(TreeList treeList, TreeListColumn columnToMerge)
       {
           this.treeList = treeList;
           this.columnToMerge = columnToMerge;
           columnToMerge.OptionsColumn.AllowMove = false;
           GetNextColumn().OptionsColumn.AllowMove = false;
           treeList.CustomDrawColumnHeader += treeList_CustomDrawColumnHeader;
           treeList.CustomDrawNodeCell += treeList_CustomDrawNodeCell;
       }

       void treeList_CustomDrawNodeCell(object sender, CustomDrawNodeCellEventArgs e)
       {

           TreeListColumn nextColumn = GetNextColumn();
           if (nextColumn == null) return;
           if (e.Column == nextColumn) { e.Handled = true; return; }
           if (e.Column != columnToMerge) return;
           Rectangle r = e.ObjectArgs.Bounds;
           r.Width = r.Width + nextColumn.VisibleWidth;
           e.ObjectArgs.Bounds = r;
       }

       TreeListColumn GetNextColumn()
       {
           if (columnToMerge.VisibleIndex == treeList.Columns.Count - 1) return null;
           return treeList.Columns[columnToMerge.VisibleIndex + 1];
       }

       void treeList_CustomDrawColumnHeader(object sender, CustomDrawColumnHeaderEventArgs e)
       {
           TreeListColumn nextColumn = GetNextColumn();
           if (nextColumn == null) return;
           if (e.Column == nextColumn) { e.Handled = true; return; }
           if (e.Column != columnToMerge) return;
           Rectangle r = e.ObjectArgs.Bounds;
           r.Width = r.Width + nextColumn.VisibleWidth;
           e.ObjectArgs.Bounds = r;
       }
   }

But I can't able to merge columns Its hiding second column value but not the border. Once I clicking the specific field I'm able to view the data also. Am I missing any thing?

Added By: Alisher (DevExpress Support) at: 6/18/2015 1:03:34 AM    Hi,

I will reply you in the Merge two columns in treeList ticket. Please refer to it for further correspondence.

XtraTabControl - How to manually paint tab header's text

$
0
0
This example illustrates how to draw tab header's text rotated 

How to force the XtraTabControl to maintain the line order in MultiLine mode

$
0
0

When the XtraTabControl is used in MultiLine mode, it automatically moves the currently selected line to the last position. This example demonstrates how to change this behavior by registering custom paint styles.

dxNumberBox - How to allow entering only integer/float numbers

$
0
0

This example demonstrates how to allow entering only numbers in dxNumberBox. For this task we need to handle the dxNumberBox.keyPressAction event and check whether the typed symbol is a number. If this is not a number, prevent the default action of the event by calling the preventDefault method of the event object that is passed to the keyPressAction event handler.

See also:
JavaScript RegExp

Question Comments

Added By: CM Tee at: 6/18/2015 9:06:10 PM    

hi, the syntax on view got error during runtime,

<div class="dx-field-value">
                   <div data-bind="dxNumberBox: integerSettings { value: qty, min: 1 }"></div>
               </div>

please help.

Added By: Alex Skorkin (DevExpress Support) at: 6/19/2015 1:20:53 AM    

Hello Jerry, 
To process your recent post more efficiently, I created a separate ticket on your behalf: T257499: The syntax for dxNumberBox interger values got error during runtime. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

GridView - How to copy cells data to clipboard by using the RichEditDocumentServer

$
0
0
This example illustrates how to copy GridView cell data to clipboard in the cfHTML format. Once copied, cell data can be pasted to an Excel file correctly and with saving formatting.

How to: Build a dock UI using the MVVM pattern

$
0
0

This example shows how to build a dock UI using the MVVM pattern.

To learn more on how to implement similar functionality in Silverlight, refer to the T245345 example.

Question Comments

Added By: David Lemieux at: 12/3/2013 5:38:24 AM    

How come the view should be responsible of creating documents and panels? In a true MVVM design this should be the ViewModel's responsibility.

Added By: David Lemieux at: 12/5/2013 8:17:17 AM    

Is anyone from DevExpress monitoring comments on examples?

Added By: Alex Zeller (DevExpress) at: 12/6/2013 5:07:00 AM    

Hello David,
The View only creates root containers where dock panels are placed. This is a required step of creating the Docking UI.

Added By: David Lemieux at: 12/16/2013 2:00:09 PM    

Alex, I was refering to MainWindow.xaml.cs file. It has AddPanel_Click and AddDocument_Click methods, in which view models instances are created.

If the purpose of the example is to demonstrate how DX docking can be used with the MVVM pattern, then the DockLayoutManagerViewModel class should be responsible for creating / adding documents. Giving this responsibility to the view class goes straight against MVVM design rules, IMHO.

Added By: Alex Zeller (DevExpress) at: 12/17/2013 4:34:14 AM    

David, you're right. We have moved the code that creates Panels and Documents to View Models.

Added By: David Lemieux at: 12/17/2013 5:16:25 AM    

Thanks. You might want to clean up MainPage's code too. The DockLayoutManagerViewModel is instanciated in both the XAML and code behind. ;)

Added By: Raju Muthu at: 1/6/2014 12:04:12 PM    

Can this example extended to using PRISM regions? or is there an example already with this feature utilizing Prism?

Added By: Gagan Kapoor at: 2/1/2014 2:54:16 PM    

Hi, I need a dock UI with ability to host different types of views in Document Group (Tabs) at run time using Prism. Can you point me to an example of it ?

Added By: Michael Ch (DevExpress Support) at: 5/22/2015 12:15:40 AM    

Hello Raju and Gagan,

We accidentally discovered that your initial posts were out of scope of our Support Center for a long time. Please accept our sincere apologies for not responding in a timely manner.

We have few samples showing of how to use the DXDocking suite with the Prism framework. Below is a list of them. Please take a moment to review them and let us know if you have additional questions.
1. Using DXDocking for WPF in accordance with Composite Application Guidelines 
2. How to use the DXDocking and DXBars components with Prism 
3. Prism - How to define Prism regions for various DXDocking elements 

Thanks,
Michael

Added By: Pere Pujol Espuña at: 6/19/2015 3:44:00 AM    

Hello,

I've been working on this sample but I have a question. How do you add a new mvvm view in a document ? For exemple a CustomerViewModel.... this is a plain sample documentViewModel1.Content = "Document View Model";   I've looking
for an easy sample to understand but I don't find anything...

Thank you!


How to register and use a custom summary function

$
0
0
This example demonstrates how to register and use a custom summary function for the Chart Control.

How to register and use a custom summary function

$
0
0
This example demonstrates how to register and use a custom summary function.

Change the filter combobox list values based on the value of another filter combobox

$
0
0

This example demonstrates how to changed the 'city' filter combobox values based on the 'country' filter combobox.

Question Comments

Added By: Sinan EGE 1 at: 6/19/2015 5:56:41 PM    

An exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll but was not handled in user code

protected void dgListe_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e)
       {
           if (e.Column.FieldName == "ilceid")
           {
               ASPxComboBox cmb = e.Editor as ASPxComboBox;
               cmb.ClientInstanceName = "cmb2";
               cmb.Callback += new DevExpress.Web.CallbackEventHandlerBase(cmb_Callback);

               cmb.DataSourceID = "dsIlce";

           }
           else if (e.Column.FieldName == "sehirid")
           {
               ASPxComboBox cmb = e.Editor as ASPxComboBox;
               cmb.ClientInstanceName = "cmb1";
               cmb.ClientSideEvents.SelectedIndexChanged = "function (s, e) { cmb2.PerformCallback(s.GetValue()); }";
               cmb.ClientSideEvents.Init = "function (s, e) { cmb2.PerformCallback(s.GetValue()); }";
           }
       }

       void cmb_Callback(object sender, DevExpress.Web.CallbackEventArgsBase e)
       {
           ASPxComboBox cmb = sender as ASPxComboBox;

           if (String.IsNullOrEmpty(e.Parameter))
               cmb.Items.Clear();
           else
           {
               dsIlce.SelectParameters[0].DefaultValue = e.Parameter;
               cmb.DataBindItems();
           }
       }

How to create a custom action type with a custom control (BarCheckItem), associated with it

$
0
0

This example demonstrates how to represent an action via the BarCheckItem. For this purpose, an ActionBase descendant (CheckableSimpleAction) is implemented. This is done because it is required to save the checked state of the action. CheckableSimpleAction uses a custom action item (CheckActionItem), which represents it in the UI via a BarCheckItem. Action item is a connector between the abstract entity Action and a particular UI element. When the form's menu is created, XAF creates action items for all actions placed to this form via action containers. This operation is performed by the BarActionItemsFactory and the ActionControlsSiteController. Since we have implemented a custom action type, it is required to implement a custom BarActionItemsFactory to assign an appropriate action item to actions of this type. The custom BarActionItemsFactory is registered via the custom factory provider (MyBarActionItemsFactoryProvider).
Note that in most cases, it is not required to implement a custom action and action item. It is sufficient to customize the existing action item via the BarActionItemsFactory.CustomizeActionControl event. This approach is demonstrated in the How to: Customize Controls Associated with an Action topic.
An example for ASP.NET is available here: How to create a custom action type with a custom control in Web.

How to sort a nested ListView at the business objects level, in code

$
0
0

This example demonstrates how to provide hidden and permanent sorting by a property in a nested ListView. Suppose we have Order and OrderItem classes that participate in an aggregated One-To-Many relationship.
We want to sort the collection of OrderItem objects by the ModifiedOn property, but do it in a way that end-users won't be able to see that the grid is sorted. Please see the sources of the Order class for more details on how to accomplish this. With this solution, sorting is implemented on the business objects level. Another variant is to use the approach from the How to sort a ListView in code example. This solution uses a specific ViewController.
Alternatively, you can use the Sorting property of the ListView application model element.

See Also:
How to prevent sorting and grouping by certain columns in a ListView

Viewing all 7205 articles
Browse latest View live


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