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

How to: Use the PieChart

$
0
0
The following example demonstrates how to create a simple Pie Chart with one series.

How to: Use the FunnelChart

How to: Use the CartesianChart

$
0
0

This example demonstrates how to create a simple Cartesian chart with 3 Stacked Bar series, populate them with data and adjust common settings.

How to: Bind a Chart to Data

$
0
0
The following example demonstrates how to bind a chart to data provided by a ViewModel.

To do this, it is necessary to assign the DataSourceAdapter object to the Series.Data property and specify the datasource for the adapter via its DataSourceAdapter.DataSource property.

How to change text and font settings of PivotDashboardItem in an ASP.Net application

How to change text and font settings of ChartDashboardItem elements in an ASP.Net application

How to: Use the BingMapDataProvider

$
0
0
This lesson demonstrates how to create a simple map application which connects to the Bing Maps data provider.

How to customize the tooltips shown for appointments

$
0
0

Problem:

How can I control the tooltip appearance and a tooltip message which is shown for each appointment? For instance, I want to change the font color and backcolor of every tooltip, and make them show not only the appointment's description, but also its subject and location. How can this be done?

Solution:

A SchedulerControl provides the TooltipController property. Use it to specify the tooltip controller, which controls the appearance of the appointment tooltips.
You should create a new TooltipController, assign it to the SchedulerControl.TooltipController property, and then set the values of the required properties. Also, you can handle the TooltipController.BeforeShow event to specify a custom text for the tooltips.
The following example illustrates this approach. Check the SuperTips checkbox to display SuperToolTips.

Question Comments

Added By: Sven Conard at: 9/20/2017 9:56:39 AM    This example doesn't work by default anymore in version 17.1 because it's missing this line so that the ToolTipController BeforeShow can be called:

this.SchedulerControl1. OptionsCustomization.AllowDisplayAppointmentFlyout = false;

How to: Use the OpenStreetMapDataProvider

$
0
0
This lesson demonstrates how to create a simple map application which connects to the OpenStreetMap data provider.

How to: Add Vector Items to a Map Using XAML

$
0
0
To add vector items to a map control using Xaml, do the following.
1. Add a VectorItemsLayer object to the MapControl.Layers collection.
2. Add vector items to the VectorItemsLayer.Items collection of the object.

How to: Bind Vector Item Source to Map Control

$
0
0
To bind a vector item source to map control, do the following.
1. Create a VectorItemsLayer object and add it to the MapControl.Layers collection.
2. Assign the vector item source to the VectorItemsLayer.ItemsSource property of the object.

How to change background color for modified cells

$
0
0

This example demonstrates how to highlight grid cells that have been edited by a user. Please note that cells won't be highlighted if data is changed at the data source level.

Question Comments

Added By: Jared Hayden at: 9/27/2012 8:53:02 AM    

This method is terrible. you are creating an IsEdited_ column for every column created and hiding that column. Just to store a Boolean. DevExpress doesn't have a better way of changing the color of a modified cell?

Added By: Alexander Ch (DevExpress Support) at: 12/9/2013 10:36:06 PM    

Indeed, this approach implies that you don't have many columns or you wish to highlight cells only for specific fields. Otherwise, I suggest that you choose one of the approaches described in the following links:

http://www.devexpress.com/Support/Center/Question/Details/Q434526

http://www.devexpress.com/Support/Center/Example/Details/E4025

Added By: Marek Sienczak at: 9/21/2017 11:19:32 PM    How to use this example to apply this feature for TreeListControl? Changing the GridControl to TreeListControl doesn't help due to lack of compatibility within functions and properties. 

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.onKeyPress 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 onKeyPress 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.

ASPxGridView - Batch Edit mode - How to use the client-side FocusedCellChanging event and cancel/disable editing an editor or row conditionally

$
0
0
Starting from version 17.1 we have introduced a new client-side FocusedCellChanging event. This event allows you to skip focusing and editing a cell.
This example demonstrates different ways to skip or prevent editing certain cells.
The main idea is to get the currently focused cell using the ASPxClientGridViewFocusedCellChangingEventArgs.cellInfo property and decide whether it is required to skip focusing or not:
[JavaScript]
function onFocusedCellChanging(s, e){if(e.cellInfo.column.name == 'command') e.cancel = true;elseif(e.cellInfo.column.fieldName == 'SupplierID') e.cancel = true;elseif(e.cellInfo.column.fieldName == 'UnitsInStock'&& (e.cellInfo.rowVisibleIndex < 3 || e.cellInfo.rowVisibleIndex > 7)) e.cancel = true;elseif(e.cellInfo.column.fieldName == 'UnitPrice'&& s.batchEditApi.GetCellValue(e.cellInfo.rowVisibleIndex, 'UnitPrice')> 22) e.cancel = true;}

How to define Prism regions for various DXDocking elements

$
0
0

This example demonstrates how to use DXDocking with PRISM. To obtain more information about how to accomplish this in a particular version, press the Show Implementation Details link.

Question Comments

Added By: K.Wessing at: 6/21/2012 1:19:15 AM    

starting in version 12.1 I get an exception, in version 11.2 the sample did work
(I based my application on this)

System.ArgumentException was unhandled by user code
  Message=This RegionManager does not contain a Region with the name 'LeftRegion'.
Parameter name: regionName
  Source=Microsoft.Practices.Prism
  ParamName=regionName
  StackTrace:
       at Microsoft.Practices.Prism.Regions.RegionManagerExtensions.AddToRegion(IRegionManager regionManager, String regionName, Object view)
       at PrismOnDXDocking.ExampleModule.ExampleModule.Initialize() in C:\Users\k.wessing\Documents\Samples\DXDocking for WPF\12.1.4\E3339\PrismOnDXDocking.ExampleModule\Module.cs:line 58
       at Microsoft.Practices.Prism.Modularity.ModuleInitializer.Initialize(ModuleInfo moduleInfo)
  InnerException:

Added By: Allan Nielsen 2 at: 7/3/2012 6:45:45 PM    

I downloaded this example and tried to run it via your example runner. We are using DXv2 (12.1) and it generates an exception as found by K.Wessing above. I also made sure I was using an up-to-date version of Prism Mef (v4.1):

System.ComponentModel.Composition.CompositionException was unhandled
  Message=The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.

1) This RegionManager does not contain a Region with the name 'LeftRegion'.
Parameter name: regionName

Resulting in: An exception occurred while initializing module 'ExampleModule'.
    - The exception message was: This RegionManager does not contain a Region with the name 'LeftRegion'.
Parameter name: regionName
    - The Assembly that the module was trying to be loaded from was:PrismOnDXDocking.ExampleModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    Check the InnerException property of the exception for more information. If the exception occurred while creating an object in a DI container, you can exception.GetRootException() to help locate the root cause of the problem.
  

Resulting in: An exception occurred while calling the 'OnImportsSatisfied' method on type 'Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager'.

Resulting in: Cannot activate part 'Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager'.
Element: Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager --> Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager --> AssemblyCatalog (Assembly="Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")

Resulting in: Cannot get export 'Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager (ContractName="Microsoft.Practices.Prism.Modularity.IModuleManager")' from part 'Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager'.
Element: Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager (ContractName="Microsoft.Practices.Prism.Modularity.IModuleManager") --> Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager --> AssemblyCatalog (Assembly="Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")

  Source=System.ComponentModel.Composition
  StackTrace:
       at System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart part, ExportDefinition definition)
       at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(ComposablePart part, ExportDefinition export, Boolean isSharedPart)
       at System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore()
       at System.ComponentModel.Composition.Primitives.Export.get_Value()
       at System.ComponentModel.Composition.ExportServices.GetExportedValueFromLazy[T](Export export)
       at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValueCore[T](String contractName, ImportCardinality cardinality)
       at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValue[T](String contractName)
       at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValue[T]()
       at Microsoft.Practices.Prism.MefExtensions.MefBootstrapper.InitializeModules()
       at Microsoft.Practices.Prism.MefExtensions.MefBootstrapper.Run(Boolean runWithDefaultConfiguration)
       at Microsoft.Practices.Prism.Bootstrapper.Run()
       at PrismOnDXDocking.App.OnStartup(StartupEventArgs e) in C:\Users\anielsen\Downloads\DXDocking for WPF\12.1.4\E3339\PrismOnDXDocking\Application.xaml.cs:line 34
       at System.Windows.Application.<.ctor>b__1(Object unused)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.Run()
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at PrismOnDXDocking.App.Main() in C:\Users\anielsen\Downloads\DXDocking for WPF\12.1.4\E3339\PrismOnDXDocking\obj\x86\Debug\Application.g.cs:line 50
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

Added By: jplopez42 at: 7/4/2012 1:18:46 AM    

Hello, we have an issue with your sample E3339 (related to the use of regions and adapters). The sample is successfully working with the 11.2.11 version in one of our testing computers. But we’re now integrating the last version of DevExpress (12.1.4) in our sandbox computer and it doesn’t work: the project is compiling but it doesn’t work (the adapters aren’t working: the flow execution isn’t entering in the adapters, in the function Adapt). We’re experiencing the same problem than K.Wessing: System.ArgumentException was unhandled by user code
  Message=This RegionManager does not contain a Region with the name 'LeftRegion'.
We have been checking your technical support and it seems there was another issue between the 11.1.x and the 11.2.x, and your teams adapted the sample project for the new DevExpress version. Is it possible that it’s happening the same?
Thanks,
       Juan Lopez

Added By: Bertrand Decoux at: 8/23/2012 8:55:43 PM    

I am using the LayoutGroupAdapter
I would like to be able to switch from one view to an other within the same LayoutGroup region.
I 've added the Remove action:
 if (e.Action == NotifyCollectionChangedAction.Remove)
            {
regionTarget.Items.Clear();
}
Scenario:
in region : <dxd:LayoutGroup cal:RegionManager.RegionName="{x:Static Infrastructure:RegionNames.DetailsRegion}" />
#1 Add a viewA - OK
#2 Remove viewA - OK
#3 Add viewB - OK
#4 Remove viewB - OK
#5 add viewA - Getting ERROR below
Please advice.
Thank you
-
{"Specified element is already the logical child of another element. Disconnect it first."}
-
   at System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject newParent)
   at System.Windows.FrameworkElement.AddLogicalChild(Object child)
   at DevExpress.Xpf.Docking.LayoutPanel.OnControlPropertyChanged(UIElement control, UIElement oldControl)
   at DevExpress.Xpf.Docking.LayoutPanel.OnControlChanged(UIElement control, UIElement oldControl)
   at DevExpress.Xpf.Docking.LayoutPanel.<.cctor>b__1(DependencyObject dObj, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
...

Added By: NP23 at: 7/29/2013 12:03:02 PM    

The Remove event is not handled in the documentgroup adapter which does not reclaim the memory when tab is closed.

Added By: Simon Cui 1 at: 8/12/2013 9:13:37 AM    

Hide the leftregion, the navbar be removed, and hide leftregin again, throw error.

Added By: Sergey Wereteychenko at: 9/3/2013 12:27:27 AM    

Why this example is so bugged?
After detaching a panel - disappears a content, please try detach Toolbox...
And why this example craches every time, when attach-detach event happening...

Please, supply Working example.

Added By: Sergey Wereteychenko at: 9/3/2013 12:36:20 AM    

private void OnItemsCollectionChanged(IRegion region, LayoutGroup regionTarget, object sender, NotifyCollectionChangedEventArgs e)
        {
            if (lockItemsChanged)
            {
                return;
            }
            if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                lockViewsChanged = true;
                var lp = (LayoutPanel)e.OldItems[0];
                var view = lp.Content;
                //lp.Content = null;
                region.Remove(view);
                lockViewsChanged = false;
            }
        }

Cause of removing content is "lp.Content = null;" row...
Why was existing this row in example?

Added By: NP23 at: 11/5/2013 11:02:15 AM    

Can you complete the code for remove action. We have something as below to remove any tabs that are floating or in the default layout group. it does not find tabs in newly created layout groups.

  case NotifyCollectionChangedAction.Remove:
                    List<DocumentPanel> panelToRemove = new List<DocumentPanel>();
                    List<FloatGroup> floatGroupToRemove = new List<FloatGroup>();
                    DockLayoutManager managerRemove = regionTarget.GetDockLayoutManager();
                    foreach (DocumentPanel panel in regionTarget.Items)
                    {
                        foreach (IPanelInfo oldItem in e.OldItems)
                        {
                            if (panel.Caption.Equals(oldItem.Title))
                            {
                                panelToRemove.Add(panel);
                            }
                        }
                    }

                    foreach (DocumentPanel pnl in panelToRemove)
                    {
                        regionTarget.Items.Remove(pnl);
                    }

                    panelToRemove.Clear();

                    foreach (var floatGroup in managerRemove.FloatGroups)
                    {
                        foreach (DocumentPanel panel in floatGroup.Items)
                        {
                            foreach (IPanelInfo oldItem in e.OldItems)
                            {
                                if (panel.Caption.Equals(oldItem.Title))
                                {
                                    panelToRemove.Add(panel);
                                }
                            }
                        }

                        foreach (DocumentPanel pnl in panelToRemove)
                        {
                            floatGroup.Items.Remove(pnl);
                        }

                        if (floatGroup.Items.Count == 0 )
                        {
                            floatGroupToRemove.Add(floatGroup);
                        }
                    }

                    foreach (FloatGroup floatGroup in floatGroupToRemove)
                    {
                        managerRemove.FloatGroups.Remove(floatGroup);
                    }

                    break;

Added By: Artem Dubenko 2 at: 8/6/2015 12:54:59 PM    

Unfortunately this example doesn't support selection/activation of the views. A call to IRegion.Activate(view) will have no effect.

Added By: Ivan (DevExpress Support) at: 8/7/2015 6:04:44 AM    Hi Artem,
I have created a new question on your behalf and posted this question there - How to activate a panel when calling IRegion.Activate. Please refer to my answer in that ticket.Added By: Nelson Peña at: 10/30/2015 9:19:11 AM    

There is an error when the Region (TabbedGroup) is unpinned and you try to open a new view in that region.

The situation is that when de TabbedGroup is unpinned also it's removed from the regions in the region manager, so the error is: This RegionManager does not contain a Region with the name 'TabRegion'.

The DockLayoutManager creates an AutoHideGroup and moves all the items from the TabbedGroup unpinned to this new AutoHideGroup but doesn't maintain the relation with the Region.

I'm using the v14.2 version. How is possible to manage this behavior?

Added By: Andrey Marten (DevExpress Support) at: 11/1/2015 8:53:13 PM    


Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T306639: The 'TabRegion' is removed from regions in the E3339 example when TabbedGroup is unpinned. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Thanks,
Andrey

Added By: Zero Drift at: 9/23/2017 7:57:55 AM    Any chance you could add a modular status bar and Login form to this?

Creating RangeControlClient that paints custom information in RangeControl

$
0
0

You can implement your own Range Control Client to paint custom information within the Range Control. To create a custom Client, create an object implementing the IRangeControlClient interface.

The Range Control Client created in this example paints a graph within the Range Control.

Question Comments

Added By: Gochmuradov M.G. at: 12/10/2012 3:55:30 AM    

And what if I want more than one ruler? For example three rulers, one for showing year, one for month and one for days. How can this be achieved. Basically I am trying to implement DateTime interval picker as in "Scheduler Range Control" but without using "Scheduler control" itself.

Added By: Çağatay ÇELİK at: 9/25/2017 12:37:58 AM    Is it possible to paint "Selection thumb" because, when they come on top of each other I want to show this situation differently.
And my second question  is; how to show flag values, when SelectionType is selected as "ThumbandFlag"  the example belowAdded By: Svetlana (DevExpress Support) at: 9/25/2017 1:18:13 AM    Hi, 

We will answer your question in the Question and Request about example with id = E4028 thread soon. Please refer to it. 

How to perform the Search operation for multiple locations

$
0
0
The Search operation is executed in an asynchronous manner and the next Search operation cannot be invoked while waiting for the result from the previous Search request. To resolve this issue, include subsequent Search method calls into the SearchCompleted event handler.

How to: Customize the Cylindrical Equal-Area Projection

$
0
0
To customize equal-area projection, do the following.

1. Set an EqualAreaProjection object to the MapItemsLayerBase.MapProjection property of a vector data layer.
2. Specify its Width/Height ratio. To do this, assign this ratio based size to the MapItemsLayerBase.InitialMapSize property of the vector data layer.

How to: Use the ArcScale

$
0
0
The following example demonstrates how to create a Circular Gauge with two needles, three ranges, one marker and one range bar.

How to: Use the LinearScale

$
0
0
The following example demonstrates how to create a Linear Gauge with two ranges and one level bar.
Viewing all 7205 articles
Browse latest View live