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

dxList - How to change the selected item color

$
0
0

To implement this task, do the following:


1. Define the Item template and wrap the template content with a Div element;

2. Apply a corresponding color to your Div based on your requirements;

3. Handle the Div click event to change the color of the selected item;

4. Define the selected item id as an observable value and configure it based on the selected item.

See also:
dxList - How to bind the style property to the data source field

Question Comments

Added By: David Karasek 2 at: 2/24/2017 10:50:59 AM    Yikes!  It's just a knockout example

How to: Use DialogService

$
0
0
This example demonstrates how you can use the DialogService.
Review this documentation topic to learn more.
Question Comments

Added By: SESHAGIRI VARANASI at: 2/26/2017 1:38:28 PM    This example doesn't work! it gives a null pointer error for DialogService property. When we instantiate DialogService using "this.GetService<IDialogService>();" it throws an exception "View Model does not extend POCOViewModel.

DashboardDesigner - How to customize the data source wizard to display a list of available tables after target data base selection

$
0
0

To customize the data source wizard use the DashboardDesigner.DataSourceWizardCustomization property
When a data source is selected, a custom ConfigureQueryPageView is shown. This view displays a list of tables from the selected data source, and automatically generates a query when a certain table is selected. 

How to handle a double-click on a grid row in a MVVM application

$
0
0

This example demonstrates one of many possible solutions for decoupling DXGrid mouse event handling from business logic, when using the MVVM architectural pattern.

Question Comments

Added By: Gert Hauan at: 1/26/2015 2:08:55 AM    

Hi

I am trying to get this to work, but without success. The reason is possibly the way that MVVM is implemented in the application I am working on. It is different from the way you have done it.

If I understand your code correctly, you have one viewmodel object pr row in the datagrid. In the application I am working on, there is one viewmodel for the whole view, that is the viewmodel is the datacontext of the view. Then the ItemsSource of the datagridcontrol is bound against a collection in the viewmodel.

Basicly what I would like to do is this: Today there is a button under the gridcontrol called "Open". This button is bound to a command in the viewmodel that opens a new (PRISM)view based on the FocusedRow. I need that same command to fire when a row is doubleclicked. Could you help me along the way here?

(It is difficult to post an example project due to the size of the app.)

Added By: Alexander (DevExpress Support) at: 1/26/2015 8:26:33 AM    

Hi Gert,

This is old example. Now, we have the MVVM Framework that allows doing such things with ease. I suggest you use the EventToCommand with an EventArgsConverter in the following manner:

[XAML]
<dxg:GridControlName="gridControl"...><dxmvvm:Interaction.Behaviors><dxmvvm:EventToCommandPassEventArgsToCommand="True"Command="{Binding EditCommand}"EventName="MouseDoubleClick"><dxmvvm:EventToCommand.EventArgsConverter><dx:EventArgsToDataRowConverter/></dxmvvm:EventToCommand.EventArgsConverter></dxmvvm:EventToCommand></dxmvvm:Interaction.Behaviors> ...</dxg:GridControl>

You can see how this code operates in the How to build a fully-functional and well-organized MVVM application in a few clicks with DevExpress components (Visual Studio 2012+) example (file - EmployeeCollectionView.xaml).

Added By: Gert Hauan at: 1/27/2015 12:59:56 AM    

Hi

Do you know if I may use  this functionality from your MVVM Framework in conjunction with the PRISM framework?

(FYI: I was able to get the double-click to work by using this approach: https://www.devexpress.com/Support/Center/Question/Details/Q534762 )

Added By: Alexander (DevExpress Support) at: 1/27/2015 1:30:09 AM    

Our MVVM Framework consists from independent parts that can be used with any other third-party framework. 

Added By: Roland Harrison at: 2/27/2017 2:59:34 AM    Would be good to update these to use the new POCOViewModel

WPF SchedulerControl API

$
0
0
This example demonstrates the WPF SchedulerControl API.
The application includes several RichEditControls at the top used to display and edit the code and  SchedulerControl (at the bottom) which shows the result of code execution. There are two groups of tabs displaying code - one for C# and another for VB languages. Each group is composed of the main tab displaying the main executable code and the tab which displays the code of the helper class used in the main code snippet. Generally the helper class is not required and the corresponding tab is empty.
You can modify the code and watch the result. The code is executed two seconds after it is modified. If an error occurs during compilation or execution, the code window background color turns to pink.

WinForms Dashboard Designer - How to customize the Data Source wizard for the OLAP data source

How to protect a PDF document with a password

$
0
0
This example shows how a PDF document can be protected using both the owner and user passwords.

A user password is used to protect opening a document. After a document is opened with the user password, a user has access to the document with the specified permissions.

To get full access to the document (permissions are not taken into account in this case), this document must be opened with the owner password.

Note that If you want to modify default user permission, you need to specify the owner password. The owner and user passwords must be different if you want the specified permissions be in effect.

The Universal Subscription or an additional Document Server Subscription is required to use this example in production code. Please refer to the DevExpress Subscription page for pricing information.


 

 

How to bind the grid to Columns and Summaries specified in ViewModel

$
0
0
This example shows how to put columns and data summary definition logic in the ViewModel and setup the Grid Control.
Question Comments

Added By: DavidGG at: 6/20/2016 1:45:26 AM    Hi,

I have downloaded the vb.net version and it does not run.
System.Reflection.TargetInvocationException was unhandled
  
  Message=Exception has been thrown by the target of an invocation.
  
Any ideas?

Thanks
Added By: Elliot (DevExpress Support) at: 6/20/2016 1:57:34 AM    

Hello David,

I've created a separate ticket on your behalf (T393961: VB version of the T273154 code example does not compile). It has been placed in our processing queue and will be answered shortly.

Added By: Greyce at: 1/10/2017 5:31:57 AM    How the header columns appear with the words separated?
Lik:
FirstName appear First Name
Added By: Ilya (DevExpress Support) at: 1/10/2017 9:41:46 AM    

Hi,
As your inquiry is not directly related to this thread, I extracted it into a separate ticket - How does GridColumn split FieldName. Let's continue our discussion there.

Added By: Tomas Winston at: 2/28/2017 6:40:34 AM    Hi,

Is this workable in the context of a CellTemplate of a GridColumn? 
Rather than setting the Binding in the FieldName I would like to access Bindings within a CellTemplate e.g.

[XAML]
<DataTemplatex:Key="DefaultColumnTemplate"><ContentControl><dxg:GridColumnHeader="{Binding FieldName}"><dxg:GridColumn.CellTemplate><DataTemplate><TextBlockText="{Binding Path=(dxci:DependencyObjectExtensions.DataContext).FieldName, RelativeSource={RelativeSource Self}}"/></DataTemplate></dxg:GridColumn.CellTemplate></dxg:GridColumn></ContentControl></DataTemplate>

How would I do this ... I guess what I would be trying to do is bind to the value of a bound property if you understand what I mean. Is that even possible?

Thanks

T

Obsolete - How to implement the best fit function, and apply it to a chart's series

$
0
0

[OBSOLETE WARNING] The approach shown in this example is not applicable in recent versions (v16.1 and later). It is recommended to calculate the "Best Fit" data using the ChartControl.BoundDataChanged event handler (see a similar approach shown in the Unhandled runtime error when implementing a custom summary function ticket).

Original description:
This example demonstrates how to implement the best fit function and apply it to a chart's series.

How to: Show a Custom Window with an Embedded XAF View

An example of using a cell range as a data source

$
0
0
This example demonstrates how to select a worksheet range and use it as a data source for Snap reports, Linear Gauge and Data Grid controls.
Select the range containing data and click Provide Data to Snap. The data source will be created and passed to Snap reports and other data-aware controls. Switch to the Snap tab to view the report and to the Thermometer tab to see the linear gauge and a grid controls bound to the worksheet range.

The data binding range is created by calling the Range.GetDataSource method. The UseFirstRowAsHeader option allows to automatically name columns in the data source. The DataSourceColumnTypeDetector option is used for specifying a custom object that provides column names and determines column types. The DataBindingCollection.Error event is handled to obtain additional information if any error occurs during data binding.

How to connect to remote data store and configure WCF end point programmatically

$
0
0

Scenario

In this example, we will create a WCF IDataStore service that will be used by our client (Console Application) as a data layer. Instead of a direct connection to the database, our client will connect to a remote service and configure the WCF end point programmatically. This is usually helpful when: 
- WCF specific customizations are required to provide custom bindings, endpoints, behavior, e.g. for a secured connection;
- Your WCF service is not hosted in IIS and thus no .svc files are used (e.g., when the WCF Class Library project is used).

Steps to implement
1. Create a remote data service and client as described in the How to connect to a remote data service instead of using a direct database connection example.

2. Create an EndPointHelper class which implements the GetDataStore static method as shown in the EndPointHelper.xx file. This method will be used to configure the WCF end point on the client.
The key is in manual creation and custom configuration of the DataStoreClient and CachedDataStoreClient objects (you can see their default configurations by checking the source code of the CreateWCFWebServiceStore and CreateWCFTcpServiceStore methods of the DevExpress.Xpo.XpoDefault class).

3. Use the GetDataStore static method in the Main method as shown in the Program.xx file to configure end point and create a IDataStore.

Important notes
1. Take special note that binding customizations must be done both in client and service programs.

2. In XAF applications it is necessary to create a class that implements the IXpoDataStoreProvider interface and return the configured IDataStore. For additional information please refer to the How to use a custom ObjectSpaceProvider in XAF example that illustrates implementation of the IXpoDataStoreProvider interface.

 

Troubleshooting
1. If WCF throws the "Entity is too large" error, you can apply a standard solution from StackOverFlow: http://stackoverflow.com/questions/10122957/
2. If WCF throws the "The maximum string content length quota (8192) has been exceeded while reading XML data." error, you can extend bindings in the following manner:

[XML]
<bindings><basicHttpBinding><bindingname="ServicesBinding"maxBufferPoolSize="2147483647"maxReceivedMessageSize="2147483647"maxBufferSize="2147483647"transferMode="Streamed"><readerQuotasmaxDepth="2147483647"maxArrayLength="2147483647"maxStringContentLength="2147483647"/></binding></basicHttpBinding></bindings>

See The maximum string content length quota (8192) has been exceeded while reading XML data

See also:
Endpoints: Addresses, Bindings, and Contracts
How to connect to a remote data service from a Silverlight application
How to implement a distributed object layer service working via WCF
How to create a data caching service that helps improve performance in distributed applications
How to connect to a remote data service instead of using a direct database connection
Extended IDataStore WCF-Service for tracking user access rights on the server after passing logon credentials from a client app
The GlobalDataClientChannelCreated or ClientChannelCreated events of the DevExpress.Xpo.DB> DataStoreClient class.

 

How to load a document into the RichEdit control

How to: Handle the Hyperlink Click Event

$
0
0

The following example demonstrates how to manually implement complex hyperlink behavior by handling the HyperlinkClick event.
In this example, this event handler is used to invoke a form with the data list. The end-user can select the item from the pop-up list and it automatically replaces the hyperlink content.

How to implement wild-card filtering in the ASPxGridView Auto Filter Row

$
0
0

Fromv2011 vol 1tov2012 vol 1
Starting with v2011 vol 1 wildcards ("%", "_", "*", "?") are no longer supported in the auto-filter row. We have migrated to new filter criteria such as StartsWith, EndsWith, and Contains. See the Breaking Changes in v2011 vol 1.4 list for a more detailed description. Still, some users may want to utilize an old-style approach and input wildcard characters in the auto-filter row. ASPxGridView allows you to do this by handing its ProcessColumnAutoFilter event. Within its handler you can check the filter input string for "*" and "?" characters, and compose a new filter criterion using criteria operators supported by our data library. This sample illustrates a simplifies approach for string fields.

From v2012 vol2 and later
Starting with v2012 vol 2 we have returned support for using wildcards in the grid's Auto Filter Row. The new LIKE operator, which supports wildcards, has been added to the AutoFilterCondition enumeration as a separate operator. The availability of this menu item is optional; by default the item is not displayed. The item's availability is controlled by the following properties:

- The grid's Settings.ShowFilterRowMenuLikeItem property;

- A grid column's Settings.ShowFilterRowMenuLikeItem property.

Note that now we provide support only for wildcards that are specific to our binary LIKE operator - (these are the '%' and '_' wildcard symbols), see Criteria Language Syntax to learn more.

Question Comments

Added By: Donn Edwards at: 5/24/2012 11:45:33 AM    

If this is such a great solution then why isn't it incorporated directly into the ASPxGridView code?

Added By: Mikunda Petr at: 10/10/2016 4:42:38 AM    Hi guys. This example is obsolete. Is there any updated example for current version?Added By: Lex (DevExpress Support) at: 10/10/2016 5:58:05 AM    

Hello,

I've created a separate ticket on your behalf (T437396: ASPxGridView - How to implement wild-card filtering in the Auto Filter Row after the version 12.2). It has been placed in our processing queue and will be answered shortly.


How to create a Card View with editing capabilities using ASPxGridView

$
0
0

To provide editing capabilities you can add the ASPxButton into the DataRow template. Set its AutoPostBack property to False, and attach a script to the client-side Click event. In the script, call the ASPxClientGridView.StartEditRow method, and pass the current row visible index in argument. Use the Container.VisibleIndex property from inline code to get the index.
To add new rows, add a similar button to the StatusBar template, and call the ASPxClientGridView.AddNewRow method in its Click event.

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 column which allows you to check/uncheck all CheckBoxes in this column.
To do this, we add a CheckEdit to the current column's header and bind its IsChecked property to the attached property. Then, we subscribe to the GridColumn's Loaded event.
When Loaded is raised, we iterate through all items in the ItemSource and subscribe to its PropertyChanged event. Also, we iterate through all cells in the current column. If the cell value equal true, we increase the total count of true values.
After that, we subscribe to the ItemSource collection's CollectionChanged event. When IsChecked is changed, we iterate through all cells of the column and set its value to the IsChecked value.
When CollectionChanged is raised, we calculate which item was added/deleted and subscribe/unsubscribe to its PropertyChanged event. Then, we calculate to what value CheckEdit must be set.
When PropertyChanged is raised, we increase/decrease the total count of true values and also determine to what value CheckEdi must be set.
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

XRPivotGrid - How to draw vertical column headers

$
0
0

This example illustrates how to use the XRPivotGrid.PrintFieldValue event handler to render vertical headers in the XRPivotGrid control.

In this sample, the default TextBrick is substituted with LabelBrick and the LabelBrick.Angle property is set to rotate text.

Question Comments

Added By: Allan Walton at: 6/27/2016 7:03:34 AM    e.brick = lb gives an error saying property brick is read-onlyAdded By: Yaroslav (DevExpress Support) at: 6/27/2016 10:14:27 AM    

Hi Allan,

Note that there are two variants of this example (the target build can be selected in the right drop-down window). Make sure you've selected the right one accordingly to the version you're currently using.

Of course, should you have any difficulties with using this example under the version you currently have, feel free to create a new ticket and elaborate on the encountered problem. We're always here to help you.

Added By: Marvin Sosa at: 3/1/2017 9:56:18 AM    Hello!
I've tried this example in an asp.net application and didn't work.
Is there any example using webforms?
Added By: Vasily (DevExpress Support) at: 3/1/2017 12:51:58 PM    

Hello Marvin,

I've created a separate ticket on your behalf (T488179: XRPivotGrid - How to draw vertical column headers). It has been placed in our processing queue and will be answered shortly.

ASPxGridView - How to populate a combo box' column inside EditForm based on the value of other column within Lambda Expressions

$
0
0

This demo illustrates how to implement cascading combo boxes in the ASPxGridView's EditForm within the Lambda Expressions.

How to provide a sequential number for each row

$
0
0

This example demonstrates how to numerate rows in the grid. For that purpose, a new unbound column will be added. The the CustomColumnDisplayText event will be handled to assign numbers to the cells in this column.

Question Comments

Added By: deepakvasudevan at: 8/21/2012 7:21:54 AM    

A small correction. In the code behind example the assignment should read as

e.DisplayText = (e.VisibleRowIndex +1 ).ToString();

to make it more realistic. Zero Indexing is too technical to address common man.

Added By: Khoa Nguyen 14 at: 3/2/2017 11:24:42 AM    Also, sample code is here:
https://www.devexpress.com/Support/Center/Attachment/GetAttachmentFile/16343094-64c5-11e4-80ba-00155d624807
Viewing all 7205 articles
Browse latest View live


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