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

How to Display a Detail View Directly in Edit Mode in ASP.NET Applications

$
0
0

In ASP.NET Web applications, when clicking a List View record, a Detail View is displayed in view mode. However, the Edit Action is available, and you can use it to reload the Detail View in edit mode. This is the default behavior. In individual scenarios, you may need to invoke a Detail View directly in edit mode. This example demonstrates how to omit the display of a View in view mode for a particular object type. For details, refer to the How to: Display a Detail View Directly in Edit Mode in ASP.NET Applications topic in XAF documentation.

Question Comments

Added By: Chanupol Phermpoon 2 at: 7/2/2014 9:01:32 PM    

I have two class in one page (xaf) and i need 2 class to editmode and i did with this code but textbox and other editor is disable ,
can't edit anything please help me ,i'm newbie in XAF thank you


How to bind a date-time chart range control client to a datasource and customize its common settings

$
0
0
This example demonstrates how to set up a range control with the date-time chart client to display a chart with date-time data in the range control's background.

In order to provide data to a chart date-time range control client, you need to access the ChartRangeControlClientDataProvider object using the ChartRangeControlClientBase.DataProvider property and assign a data source to the ChartRangeControlClientDataProvider.DataSource property. Then specify the required data fields via the  ChartRangeControlClientDataProvider.ArgumentDataMember, ChartRangeControlClientDataProvider.ValueDataMember, and ChartRangeControlClientDataProvider.SeriesDataMember (optional) properties.

In the current example, a date-time chart client is bound to a simple data table containing three columns ("Argument", "Value", and "Series").

In addition, this example shows how to customize chart client common settings (e.g., change the date-time range, customize template view and grid options).

How to: Manage documents via WindowedDocumentUIService and TabbedDocumentUIService

$
0
0

The WindowedDocumentUIService provides methods to create and show documents as windows.
The TabbedDocumentUIService provides methods to create and show documents as tabs.
The CurrentWindowService provides methods to close the current window.

The following example demonstrates how to use the above services in a View Model.

If you wish to perform some actions when the document is about to close or wish to prevent a document from being closed, implement the IDocumentViewModel interface for the view model that represents a document. The IDocumentViewModel.Close method will be called before the document closure.

How to bind a numeric chart range control client to a list of custom objects

$
0
0
This example shows how to bind a numeric chart range control client to a System.Collections.Generic.List containing NumericItem objects.

In order to provide data to a chart numeric range control client, you need to access the ChartRangeControlClientDataProvider object using the ChartRangeControlClientBase.DataProvider property and assign a data source to the ChartRangeControlClientDataProvider.DataSource property.

Each NumericItem object contains Argument,  Value and Series properties, to which a numeric chart range control client is bound via its ChartRangeControlClientDataProvider.ArgumentDataMember, ChartRangeControlClientDataProvider.ValueDataMember, and ChartRangeControlClientDataProvider.SeriesDataMember (optional) properties.

In addition, this example shows how to customize chart client common settings (e.g., change the numeric range, customize template view and grid options).

How to enable editing in a group row so it is possible to change child cell values

$
0
0

This example illustrates how to show an editor in a group row under a corresponding column. The editor corresponds to an in-place editor used in the column.

To invoke the group editor click the group row once or twice based upon the GroupEditProvider.SingleClick property. Then, you can enter any value in this editor. To apply this value to child cells and close the editor you should either press the Enter key or force the editor to lose focus. To discard changes press the Esc key when the group editor is active.
Also, you can provide end-users with a visual effect pointing that he/she can invoke the group editor for a group row located under the mouse pointer. For this, enable the GroupEditProvider.ShowGroupEditorOnMouseHover property.

Question Comments

Added By: Andrew Xi at: 7/4/2014 5:48:33 AM    

It is super!   I am using DevExpress WPF and looking for this feature in WPF. How could I have this feature in WPF with DevExpress?

Added By: Andrew Ser (DevExpress Support) at: 7/4/2014 6:28:47 AM    

Hello,
I've extracted your inquiry into a separate ticket - How to enable editing in a group row so it is possible to change child cell values. We will answer you there.

How to Conditionally Apply Styles (CellStyle)

$
0
0

This example demonstrates how to apply a custom style to cells displayed within the 'Product Name' column based on a custom condition. A product's name is highlighted if the number of units is less than 20.

OBSOLETE. Starting from version 14.1, DXGrid introduces the built-in conditional formatting feature.

Question Comments

Added By: Bharadwaz Avvari at: 5/7/2014 2:38:37 AM    

there is No color change in the this example. I think something is missing please check it once again. and Re post it

Added By: Elliot (DevExpress Support) at: 5/7/2014 3:26:29 AM    This issue will  be processed in the How to Conditionally Apply Styles (CellStyle) ticket.Added By: aymeric daverat at: 5/9/2014 2:08:49 AM    

Hi, I have some troubles using this exmaple.
The cells are correctly colorized, but when I select the row, the default focused row color is not applied ( I would like the selected theme one)
What can I do then ?
Thanks a lot for your answer

Added By: Alexander Rus (DevExpress Support) at: 5/9/2014 4:00:14 AM    

Hi,
By default, when the xxxThemKey markup extension is used, resources are searched in the DeepBlue theme. When another theme is applied, it is necessary to use the ThemeName attribute in resource keys, for example:


BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=CellStyle, ThemeName=MetropolisDark}}"

Thanks,
Alexander

WinForms End-User Designer - How to customize the data source wizard connection string storage

$
0
0

By default, the report connections list is populated based on the connections stored in the application configuration file. In any case,, the application configuration cannot be modified at runtime, that's why the report connections list is not changed when the Reports End-User Designer is used.

To initialize, save and restore the connection strings in the Reports End-User Designer, use the approach demonstrated in this code example.

The main idea of this approach is to create a custom connection storage service (the ConnectionStorageService class descendant). Also, the SqlDataConnection class descendant (CustomSqlDataConnection) is used in this example to customize the connection names in the connections list.

Custom GridControl - How to provide the capability to hide group footer rows at a specific group level

$
0
0

This example demonstrates how to implement the ShowGroupFooter event which allows hiding group footer rows at a specific group level. To specify which rows should be hidden, set the e.Visible parameter to false. The e.FooterLevel parameter specifies the grouping level at which footer visibility should be processed.

Question Comments

Added By: Stécy at: 7/7/2014 8:00:40 AM    

Great solution.

Is it possible to show the footer for a collapsed level?

Added By: Svetlana (DevExpress Support) at: 7/7/2014 11:36:15 PM    Hi, 

I have extracted your inquiry to a separate ticket . Please refer to it. 

How to change a TreeList node position along with a corresponding record's position in the database

$
0
0

TreeList allows users to reorder nodes by dragging them with the mouse. If a node was moved from one parent to another, its position will be saved automatically, because it depends on the ParentID column value which is stored in the database. However, when nodes are reordered within the child collection, their position will be reset after the application is closed and opened again, or after reloading data.

To keep nodes positions, it is necessary to add additional column to the datasource to store the node index. In this situation, nodes positions can be restored after loading the data into the TreeList. This task can be accomplished by iterating all the nodes and updating the node index via the TreeList.SetNodeIndex method.

[C#]
voidUpdateNodesPositions(TreeListNodesnodes){List<TreeListNode>ns=newList<TreeListNode>();foreach(TreeListNodeninnodes)ns.Add(n);foreach(TreeListNodeninns){UpdateNodesPositions(n.Nodes);n.TreeList.SetNodeIndex(n,Convert.ToInt32(n.GetValue("Order")));}}
[VB.NET]
PrivateSub UpdateNodesPositions(ByVal nodes As TreeListNodes)Dim ns AsNew List(Of TreeListNode)()ForEach n As TreeListNode In nodes ns.Add(n)Next nForEach n As TreeListNode In ns UpdateNodesPositions(n.Nodes) n.TreeList.SetNodeIndex(n, Convert.ToInt32(n.GetValue("Order")))Next nEndSub

How to filter a second LookUp column based on a first LookUp column's value in EditForm

$
0
0

This is an example for the How to filter a second LookUp column based on a first LookUp column's value in EditForm Knowledge Base article. Please refer to the article for the explanation.
Note that the GridView.EditFormPrepared event is used in this example. This event appeared in version 13.2.7.
If you are using previous versions (13.1.x - 13.2.6), create a custom EditForm as described in the Custom Edit Form help topic and use the approach for standalone editors from the How to filter a second LookUp column based on a first LookUp column's value KB article.

Lesson 1 - Creating a Simple WinForms MVPVM Applicaiton

$
0
0
This example demonstrates how to build a simple WinForms application that follows the MVPVM pattern.

OBSOLETE: How to implement a hyperlink functionality in the LabelControl

$
0
0

This feature is available out-of-the-box starting from version 13.1. See HTML Text Formatting


For earlier versions:

This example illustrates how to create a custom LabelControl so that it can display hyperlinks. For this, enable the LabelControl.AllowHtmlString property and use the tags to add a hyperlink to a text.

Question Comments

Added By: Oleg Khozyainov at: 7/18/2012 2:35:12 AM    

The sample does not work with 11.2 and 12.1.
I get Null reference exception in GetLinkText method when I move mouse pointer over the hyperlink.

Added By: Oleg Khozyainov at: 7/18/2012 8:18:14 AM    

Here is how I changed it, so it works again now:
GetLinkText method used reflection to call StringInfo private properties.
Now, these properties are public.
I changed GetLinkText code to:
List<StringBlock> blocks = ViewInfo.StringInfo.Blocks;
List<Rectangle> blocksBounds = ViewInfo.StringInfo.BlocksBounds;
and it works fine now.

Added By: Stefan Koell at: 1/22/2013 3:58:01 AM    

This doesn't work very well when used with images or links with mailto: syntax. Not sure why. Anyway, I really wish that DevExpress includes that functionality in their suite with full support.

Added By: Glen Harvy at: 2/3/2013 4:25:28 PM    

In Version 12.2.6 the GetLinkText method throws an error:

The property or indexer 'DevExpress.XtraEditors.ViewInfo.BaseControlViewInfo.StringInfo' cannot be used in this context because the get accessor is inaccessible

Added By: Glen Harvy at: 2/3/2013 4:46:26 PM    

12.2.6 After virtually copying and pasting this code I now get

System.NullReferenceException was unhandled
  HResult=-2147467261
  Message=Object reference not set to an instance of an object.
  Source=MyCourts
  StackTrace:
       at MyCourts.LinkLabelControl.GetLinkText(MouseEventArgs e) in c:\Users\Administrator\Documents\My Projects\MyCourts\LinkLabelControl.cs:line 121
       at MyCourts.LinkLabelControl.GetLink(MouseEventArgs e) in c:\Users\Administrator\Documents\My Projects\MyCourts\LinkLabelControl.cs:line 110
       at MyCourts.LinkLabelControl.SetCursor(MouseEventArgs e) in c:\Users\Administrator\Documents\My Projects\MyCourts\LinkLabelControl.cs:line 102
       at MyCourts.LinkLabelControl.OnMouseMove(MouseEventArgs e) in c:\Users\Administrator\Documents\My Projects\MyCourts\LinkLabelControl.cs:line 97
       at System.Windows.Forms.Control.WmMouseMove(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)
       at DevExpress.XtraEditors.BaseControl.WndProc(Message& msg)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
       at DevExpress.XtraSplashScreen.ThreadManagerBase.ThreadEntryPoint(Object skinName)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart(Object obj)
  InnerException:

Added By: Joseph N. Musser II at: 5/16/2013 9:20:24 AM    I implemented a more comprehensive version using this as a guide.

1) It handles cases where two StringBlocks have the exact same text or do not match the link text. In cases like &lt;link=command1&gt;Test &lt;b&gt;bold&lt;/b&gt;&lt;/link&gt; the current code fails because no block has the text &quot;Test &lt;b&gt;bold&lt;/b&gt;&quot;; there are actually two blocks for that link. The strategy I used is impossible to confuse.

2) It has color properties and redraws nicely for hover and pressed states.

3) It allows &lt;link&gt;Test&lt;/link&gt; or &lt;link=command string&gt;Test&lt;/link&gt; and provides a LinkClicked event with the index of the link and the command string, if specified. This is better for programmability (and safer!) than Process.Start.
(The command string can contain the &#39;&gt;&#39; character if you escape it: &lt;link=this &gt;&gt; works&gt; gives &quot;this &gt; works&quot;.)

It is thirty lines longer and the code is better performance-wise as well. If this interests you, I may be able to submit it.Added By: Joseph N. Musser II at: 5/16/2013 9:22:13 AM    

The comment system replaced my angle brackets with &gt; etc. Ahem.

Added By: Matt Jacobi at: 9/25/2013 11:22:18 AM    

This example breaks down if the hyperlink wraps (is broken across two lines). GetLink fails to match up with a known link.

How to align a RibbonPageGroup to the right side of a page?

$
0
0

This example demonstrates how to create a custom RibbonControl that displays a group with the "AlignRight" tag assigned at the right side.

Updated:

The example was slightly modified to dispose of a gap which occurs after merging (see  Support correct RibbonPageGroups alignment with no gap on ribbon merging).
To enable correct operation, a RibbonPanelComplexLayoutCalculator descendant was created, and the UpdatePanelLayout method was overridden in it.

Question Comments

Added By: Andri at: 9/9/2013 2:02:47 PM    

Hi do you have a fix for this if there are more than one group on the right side ?

How to create a TimeEdit descendant which will allow editing and displaying TimeSpan values

$
0
0

This example shows how to create a TimeEdit descendant which will allow editing and displaying TimeSpan values, and entering more than 24 hours.

See Also:
How to create a custom editor that will allow editing TimeSpan values

Question Comments

Added By: Stefan at: 6/7/2013 9:36:08 PM    

Hi,

Can this be upgraded to v2013 vol 1.4.

Thanks,
Stefan.

Added By: Norbert Kustra at: 6/13/2013 7:09:19 AM    

Hello, I am waiting for 2013.1.4 upgrade.
Thanks Norbert

Added By: Arnaud Chevallier at: 11/29/2013 2:34:35 AM    

Hello All,

When I use this editor directly in a DevExpress.XtraBars.Ribbon.RibbonForm the Designer generates this code:

            //
            // tsEditDuration
            //
            this.tsEditDuration.EditValue = System.TimeSpan.Parse("00:00:00");
            this.tsEditDuration.Location = new System.Drawing.Point(74, 50);
            this.tsEditDuration.MenuManager = this.ribbon;
            this.tsEditDuration.Name = "tsEditDuration";
            this.tsEditDuration.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.tsEditDuration.Properties.DisplayFormat.FormatString = "HH:mm:ss";
            this.tsEditDuration.Properties.EditFormat.FormatString = "HH:mm:ss";
            this.tsEditDuration.Properties.Mask.EditMask = "HH:mm:ss";
            this.tsEditDuration.Size = new System.Drawing.Size(100, 20);
            this.tsEditDuration.TabIndex = 0;

So far everythings are fine.

But when I use this editor in a custom control derived from DevExpress.XtraEditors.XtraUserControl the Designer generates this code:

            //
            // tsEditDuration
            //
            this.tsEditDuration.EditValue = System.TimeSpan.Parse("00:00:00");
            this.tsEditDuration.Location = new System.Drawing.Point(215, 110);
            this.tsEditDuration.Name = "tsEditDuration";
            this.tsEditDuration.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
            this.tsEditDuration.Properties.DisplayFormat.FormatString = "HH:mm:ss";
            this.tsEditDuration.Properties.EditFormat.FormatString = "HH:mm:ss";
            this.tsEditDuration.Properties.EditValueChangedFiringMode = DevExpress.XtraEditors.Controls.EditValueChangedFiringMode.Default;
            this.tsEditDuration.Properties.Mask.EditMask = "(0(\\R.([0-1]\\d|2[1-3])|\\d)|1(\\R.(0\\d|1[0-1])|\\d)|2\\d|3[0-5])\\R:[0-5]\\d\\R:[0-5]\\d";
            this.tsEditDuration.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx;
            this.tsEditDuration.Size = new System.Drawing.Size(89, 20);
            this.tsEditDuration.TabIndex = 14;

In the second case I can't edit the value. The EditMask string is displayed instead of the actual value. As a workaround you need to edit the designer generated code.

Regards,
Arnaud.

Added By: Constant (DevExpress Support) at: 12/24/2013 3:37:58 AM    

I have tried to replicate the issue but have not noticed any issues. If you still experience the same problem, please create a separate ticket regarding it and describe the issue in greater detail. A sample project demonstrating the problem will be very helpful.

Added By: Jackson Cheng at: 7/9/2014 3:10:17 AM    

Hi,
How can I force the format to be like 00:00:00 instead of 0:00:00?
I tried changing the culture fed to the manager or the _Hxxx in FormatInfo but they seem to be the wrong place.
Thanks.

Added By: Mariya (DevExpress Support) at: 7/9/2014 4:59:00 AM    Hi Jackson,
I have created a new ticket on your behalf and passed it to our team for research: How to change TimeSpan value format in the TimeEdit descendant class .

GridView - How to implement date range filtering using a custom editor in the AutoFilterRow


How to create a Breadcrumb Control

$
0
0

This example demonstrates how to create a Breadcrumb Control based on a TextEdit. In the sample, the Breadcrumb Control consists of two layers: TextEdit and ItemsControl (which is invisible when TextEdit is focused).

How to create Checkable Grouping in GridControl

$
0
0

The example demonstrates how to add the CheckBox functionality to each GroupRow in TableView. The basic idea is to allow a user to easily check or uncheck the necessary group of items in GridControl.

The functionality is realized as behavior in the CheckableGroupBehavior class, which can be attached to GridControl. It automatically sets GroupValueTemplate using the GroupCheckBox class, which is inherited from the CheckBox class. The CheckableGroupBehavior's CheckableProperty must be set and has to contain the name of the property in a row data object, which will be used to check items. The property has to be of the Boolean type.

You can easily add the same functionality to your project by using the CheckableGroupBehavior class and attaching it as behavior to your GridControl.

How to emulate Binding to the IsExpanded property of the TreeListNode in the TreeView of GridControl

$
0
0

Because the TreeListNode’s IsExpanded property is not a DependencyProperty, there is no way to create TwoWay binding between the IsExpanded and data source item’s property. The example demonstrates how to emulate this functionality using behaviors.

BindableExpandingBehavior class attaches to a GridControl to provide the functionality. The BindableExpandingBehavior’s ExpandingProperty must be set and has to contain the name of the property in a data item, which will be used to expand/collapse the TreeListNode. The type of the property has to be Boolean.

The behavior will be automatically enabled for each level in TreeListView where a data item contains the same property name set in the BindableExpandingBehavior’s ExpandingProperty.

You can easily add the same functionality to your project using BindableExpandingBehavior class and attaching it as a behavior to your GridControl.

How to create Search Window with Find Previous and Find Next buttons in GridControl

$
0
0

The example demonstrates how to create a Search window for GridControl with the Find Previous and Find Next buttons. The Search window appears on pressing the Ctrl+F keys when GridControl is focused. The search process starts automatically on typing text in the Find Text field. All matching text is highlighted in grid cells. The Previous and Next buttons allow iterating through these cells. The F3 and Shift+F3 keys also help perform the same actions by using a keyboard. In addition, the Search window theme relates to the parent's GridControl. To highlight the matching text, the SearchString property of a TreeView object in GridControl is used.

You can easily add full functionality of the Search window to your project by using the SearchBehavior class and attaching it as Behavior to your GridControl.

 

How to customize PDF Viewer Ribbon

$
0
0

The following example shows how to customize PDF Viewer Ribbon.

To accomplish this task, it is necessary to override the default PdfViewerControl's RibbonTemplate and add the required bar items to the newly defined RibbonControl.

Updated

Starting with version 14.1.5, you can use actions instead of modifying the template to customize the PdfViewerControl's Ribbon.

Viewing all 7205 articles
Browse latest View live


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