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

How to access a tab control in a Detail View layout

$
0
0

Scenario
This example demonstrates how to implement a View Controller that will access layout controls and customize them as required. In particular, the second tab in the tab control should become active when opening the detail form.

Steps to implement

1. This functionality is implemented in the WinCustomizeTabControlViewController and WebCustomizeTabControlViewController classes that are added into the WinForms and ASP.NET module projects respectively (copy these classes into the respective projects of your test solution). Take special note that on the Web we are activating a required tab on the client side instead of using the server-side ASPxTabControlBase > ActiveTabIndex property, which is not appropriate for updating tab control on external callbacks (learn more...).

2. To identify the layout element by the "TabbedGroup" string, make sure this identifier is specified under the Views | YourBusinessObject_DetailView | Layout node in the Model Editor invoked for the YourSolutionName.Module/Model.DesignedDiffs.xafml file.

See also:
 
eXpressApp Framework > Concepts > UI Construction > View Items Layout

Question Comments

Added By: Wieland Voß at: 4/26/2016 11:30:50 PM    Hi all.

Do you have a hint for me, how to determine the index of the active tab?
And moreover, how to determine the index of a particular tab (i. e. by name)?

I want to switch to the "totals" tab, only if the "particulars" tab is the active one.

Best regards,
Wieland

Added By: Dennis (DevExpress Support) at: 4/26/2016 11:37:37 PM    

@Wieland: I've created a separate ticket on your behalf (T372263: how to determine the index of the active tab?). It has been placed in our processing queue and will be answered shortly. Please specify your target platform in that new ticket as well (WinForms/Web).


Runtime report merging

$
0
0

Given a collection of XtraReports the goal is to merge each page of every report into a single report document. A custom PrintHelper class encapsulates the Link associated with the resulting document. PrintHelper handles Link.CreateDetailArea, calling e.Graph.DrawBrick for each brick of the constituent reports. If the constituent reports are of unequal page length, a red crossbox is drawn as a placeholder in the empty page areas corresponding to the shorter reports.

Question Comments

Added By: Anurag Mahato at: 11/30/2016 2:17:36 AM    Hello I want same thing in WPF.

How to customize the settings of a toolbar item created for an Action.

$
0
0

This example is now obsolete. The functionality demonstrated here is a part of the Feature Center located here: C:\Users\Public\Documents\DevExpress Demos 16.2\Components\eXpressApp Framework\FeatureCenter\CS. The complete description is still available in the How to: Customize Action Controls topic.

See Also:
How to create custom action type with custom control (BarCheckItem), associated with it

Question Comments

Added By: Mario Blatarić at: 9/17/2013 4:01:09 AM    

Could you provide an example of how to do the same thing on Web? Web version of http://documentation.devexpress.com/#Xaf/CustomDocument3183 documentation article would also be helpful.

Added By: Dennis (DevExpress Support) at: 10/23/2013 4:20:20 AM    

Thanks for your suggestion, Mario. We will consider creating a Web version in the future.

How to make the auto filter row's filter accent insensitive

$
0
0

This example demonstrates how to create a custom function that removes all diacritic symbols from the specified string value. Using the GridView.SubstituteFilter event, this function can be injected into the active grid filter.

The SubstituteFilter event was added in version 2015 vol 1. To accomplish this task in older version, create a custom grid and customize the mechanism of filtering data via the auto filter row. For this, the GridView.RaiseCustomRowFilter method can be overridden. In this method, the cell text and filter string should be normalized via the standard String.Normalize method and then the cell value is processed based on the comparison operator type returned via the OptionsColumnFilter.AutoFilterCondition property.

Question Comments

Added By: Martin Šváha at: 8/26/2016 2:33:32 AM    Dear DevExpress support.
I have used SubstituteFilter event for accent insensitive GridView in GridLookupEdit.
There is a problem and I can't find solution for typing with accent insensitive.
Filtering is ok.

For example, I have cities like this:

Kosiny
Kosonohy
Košice
Košice - západ

When I filter Kosi, then control filters cities:

Kosiny
Košice
Košice - západ

This is ok, but I can´t type into filter row Kosic, only Kosin.

How can I allow to disable accent in typing into filter row?

Thanks for any idea
Martin


Added By: Stas (DevExpress Support) at: 8/26/2016 7:24:49 AM    

Hello,

I've created a separate ticket on your behalf (How to disable accent in typing into a filter row in the E5021 example). It has been placed in our processing queue and will be answered shortly.

Added By: david castellanos at: 11/30/2016 4:19:20 AM    This solution is giving me an error:

'System.InvalidOperationException' en DevExpress.Data.v16.1.dll


Custom function 'RemoveDiacritics' does not implement the ICustomFunctionOperatorConvertableToExpression interface.

Added By: Uriah (DevExpress Support) at: 11/30/2016 5:14:27 AM    

Hello David,

I've created a separate ticket on your behalf (T456901: The solution provided in the E5021 ticket throws UnvalidOperationException: Custom function 'RemoveDiacritics' does not implement the ICustomFunctionOperatorConvertableToExpression interface). It has been placed in our processing queue and will be answered shortly.

How to customize the tabbed header based on the panel name in the DockManager (creating a custom theme)

$
0
0

It's necessary to re-specify templates corresponding to the defined resource keys. The tabbed group page header and template are placed in the TabbedPaneElementsThemeKey. The resource keys for the page header are the PageHeader and Template keys, respectively. These are the keys you should re-specify:

 

[XAML]
<ControlTemplatex:Key="{dxt:TabbedPaneElementsThemeKey ResourceKey=Template}"TargetType="{x:Type ve:TabbedPane}"><ControlTemplatex:Key="{dxt:TabbedPaneElementsThemeKey ResourceKey=PageHeader}"TargetType="{x:Type TabItem}">

 

To change an appearance of a tabbed header based on the panel Name property, add the following DataTrigger to the ControlTemplate.Triggers of the "{dxt:TabbedPaneElementsThemeKey ResourceKey=PageHeader}" key:

 

[XAML]
<DataTriggerBinding="{Binding Path=Name}"Value="MyPanel">     <SetterProperty="Background"TargetName="inactive_border"Value="#FFD4A8BD"/>     <SetterProperty="Background"TargetName="inactive"Value="#FFF5D3C3"/></DataTrigger>


In the sample, the panel with the Name property equal to MyPanel is shown using a different color than other panels.

How to create an analog of GridLookUpEdit with TreeList in a popup window

$
0
0

This example is obsolete. We've included the TreeListLookUpEdit editor in our suite in version 13.1.


In some cases, it is useful to display data within LookUpEdit in the hierarchical structure.

This can be introduced by creating a custom editor – TreeListLookUpEdit.

This example illustrates how to create such an editor.

Here we have implemented the following features:


- The RepositoryItemTreeListLookUpEdit.ValueMember and RepositoryItemTreeListLookUpEdit.DisplayMember properties. They are intended for the same functions as in a regular LookUpEdit/GridLookUpEdit.

- The ProcessNewValue event is implemented like in LookUpEdit/GridLookUpEdit. This event is raised when an editor is validated and its display value does not exist within an inner TreeList.

- The property SearchMode allows you to select one of the following modes:

     o OnlyInPopup. This mode is an analog of IncrementalSearch, but it also expands nodes if it is needed when you type a search text. This mode works only if a popup window is shown.

     o AutoComplete. In the Auto Completion mode, the text in the edit box is automatically completed if it matches a DisplayMember field value from drop-down nodes.

     o AutoFilter. This mode applies a filter to the DisplayMember column. Filter is formed when you type a text in the edit box. In addition, it opens a popup window and looks for nodes retaining paths to the root to show the context.

For virtual data loading (on demand) in the inner TreeList you can handle its BeforeExpand event. Please refer to the following help articles:


How to: Implement Dynamic Loading in Unbound Mode
Dynamic Data Loading via Events
How to: Implement a Tree Structure for a Business Object

 to learn which virtual Modes TreeList supports.

Question Comments

Added By: (no info) at: 3/18/2013 6:00:11 AM    

Hi,

I'm Trying to make my custom control TreeListLookUpEdit and everything goes fine except this line: (DXCategory is not defined...)
<DXCategory(CategoryName.Behavior), DefaultValue(SearchMode.OnlyInPopup)> _

¿Any solution for this?

Thanks,
Iker.

Added By: (no info) at: 3/26/2013 4:27:57 AM    

I'm using the 12.1.5 versión of DevExpress, may be this the problem?

Added By: khoem chanthan 1 at: 12/1/2016 8:26:37 PM    Can you project example
Added By: Andrew Ser (DevExpress Support) at: 12/1/2016 11:39:58 PM    

Hello,
You can download the sample from the link on the right (see the screenshot).
However, before you download it, I would like to point out that we added the full-functional TreeListLookUpEdit in v13.1. So, this example is obsolete.

How to create a label in the PageHeader band when a field is dragged from the Field List to the Detail band

$
0
0

This example illustrates how to create a label in the PageHeader band when a field is dragged from the Field List to the Detail band. 

The example demonstrates two approaches. The first approach uses the overridden FieldDragHandler class.
The second approach creates a label in the PageHeader band in the XRDesignPanel.ComponentAdded event handler.

OBSOLETE - ASPxGridView - Batch Editing - How to use external buttons to update data and enable them only when a row/cell has been changed

$
0
0

UPDATED:

Starting with v16.1, this feature is available out of the box. Please refer to the ASPxGridView, ASPxCardView - Change Save and Cancel buttons' enabled state when an end-user changes a value in BatchEdit mode thread for additional information.

For earlier versions: 

This example demonstrates how to create external Update and Cancel buttons, and enable them only when an end-user edits a cell or a row. 

See Also:
ASPxGridView - Batch Editing - How to show save and cancel buttons only when any row/cell has been changed
MVC Example:
GridView - Batch Editing - How to use external buttons to update data and enable them only when a row/cell has been changed

Question Comments

Added By: Esther Hazan at: 12/1/2016 7:17:36 AM    is there still no way to just move the button to the top of the grid?Added By: Larry (DevExpress Support) at: 12/2/2016 3:00:29 AM    

Hello,

I see that you have already asked this question in the context of the ASPxGridView move status panel to top thread. So, I recommend you post all comments related to this issue in that thread.  


How to export a report to PowerPoint

$
0
0

This example demonstrates two techniques. The first technique demonstrates how to add a custom item to the "Export to" drop-down list of the HTML5 Document Viewer control. A custom item is added in the client-side ASPxClientWebDocumentViewer.CustomizeMenuActions event handler. The second technique demonstrates how to export a report to the PowerPoint (PPT) file format. Please review the Exporting Reports to PowerPoint article to get more information about this approach.

Note, it is necessary to have MS Office installed on the server machine, since the example has a reference to the Microsoft.Office.Core v15 assembly.

How to show images in the CheckedComboBoxEdit edit box and its dropdown window

$
0
0

This examples demonstrates how to display images in the CheckedComboBoxEdit edit box and its dropdown window when the editor is used in bound mode. This task is accomplished at an editor descendant level.

To show images in the dropdown window, it is necessary to set the RepositoryItemCheckedImageComboBoxEdit.ImageMember property to a column name whose values represent Image objects or a byte array. If you wish to display these images in the edit box, you should also set the RepositoryItemCheckedImageComboBoxEdit.ShowImagesInEditBox property to true.

Question Comments

Added By: Michael Osborne at: 12/2/2016 7:27:22 AM    Once I have this editor, how do I assign images to it?Added By: Alisher (DevExpress Support) at: 12/2/2016 7:47:41 AM    Hi Michael,

As noted in the description, to show images in the dropdown window, it is necessary to set the RepositoryItemCheckedImageComboBoxEdit.ImageMember property to a column name whose values represent Image objects or a byte array. Have you set this property?

How to manage users (register a new user, restore a password, etc.) from the logon form in ASP.NET

$
0
0

Scenario
This example contains a reusable Security.Extensions module that provides a possible solution for the following scenarios:

Security - provide the capability to register a new user from the logon form
Security.Authentication - provide a "Forgot Password" feature


Steps to implement

In order to use this module in your project, do the following:

1. Download and include the Security.Extensions module project into your XAF solution (as per MSDN) and rebuild it. This custom module contains Application Model settings (Model.DesignedDiffs.xafml) to layout custom Actions next to the logon form input fields (see the How to: Include an Action to a Detail View Layout  article for more details) as well as non-persistent data models for parameter screens (LogonActionParameters.cs) and finally a ViewController (ManageUsersOnLogonController.cs) for the logon DetailView that declares custom Actions and their behavior. The controller is registered via the XafApplication.CreateCustomLogonWindowControllers event in the ModuleBase descendant (Module.cs) along with other service logic.

2. Invoke the Module Designer for your platform-agnostic module and drag and drop the SecurityExtensionsModule from the Toolbox;

3. Add the following code into your platform-agnostic module class:

[C#]
staticYourPlatformAgnosticModuleName(){SecurityExtensionsModule.CreateSecuritySystemUser=Updater.CreateUser;}

where 'Updater.CreateUser' is your custom method that matches the following definition:

[C#]
publicdelegateIAuthenticationStandardUserCreateSecuritySystemUser(IObjectSpaceobjectSpace,stringuserName,stringemail,stringpassword,boolisAdministrator);

 

IMPORTANT NOTE
This module is currently ASP.NET only.

Question Comments

Added By: Daniele Bonetti at: 8/27/2012 3:14:19 PM    

downloaded and run the demo but i receive "Object reference not set to an instance of an object" error
xaf 12.1.5

Added By: octavia at: 9/24/2012 12:03:14 AM    

It can't be run. Object reference not set to an instance of an object" error

Added By: Santiago Moscoso at: 11/12/2012 3:39:21 PM    

On windows needs to invoke "EnsureShowViewStrategy" method from application, it's protected so you must use reflection.

On web I have problems with the action buttons not refreshing properly, must presh F5 to update buttons. (I'm working on 11.2.11)

Added By: Evgeniy Meyke at: 11/26/2012 4:59:41 AM    

Dennis, any chance to have this checked out soon?

   //Dennis: TODO
            //A possible issue in the framework - Controllers from ShowViewParameters are not added to the current Frame on the Web.
            //e.ShowViewParameters.Controllers.Add(CreateDialogController());

Added By: drew.. at: 3/9/2013 1:16:29 PM    

quick question before i begin integrating this: referring to the comment above " Include the module sources into your solution and rebuild it;" .. are you referring to the modules as listed below, or ALL the xaf modules?

Added By: drew.. at: 3/11/2013 10:12:45 AM    

.. for the benefit of others, this reference to "module" in #1 above, means to drop the entire Security.Extensions folder from the demo into your current solution that you want to update with the basic feature. Then add a reference from your platform-agnostic module (PAM) to the added project, rebuild, THEN go into the module designer for the PAM and drag-n-drop your newly added security module into the required modules section. Then rebuild again.

Added By: drew.. at: 3/11/2013 10:31:40 AM    

btw, i am in the process of integrating this with my DC-only based project. Once i have all the conversions done and tested i will likely post the project to help others save time.

Added By: Mario Blatarić at: 3/12/2013 1:59:10 AM    

Which parts make this module ASP.NET only? I don't understand what needs to be changed in order to make this work in WinForms as well. Any hints?

Added By: John01 at: 4/16/2013 8:10:38 AM    

Hi

When I run the example and click OK on register user I get the error 'Property 'Email' does not exist within type 'DevExpress.ExpressApp.Security.Strategy.SecuritySystemUser'.' on line user.SetMemberValue("Email", email) in function CreateUser. The email value is 'sam@example.com'. I did upgrade the project to 12.2.7 before running though. Any ideas?

Thanks

Regards

Added By: CArlos segura_1 at: 6/13/2013 1:22:53 PM    

someone has been to implement this?

Added By: Tony Tadros at: 9/5/2013 11:51:37 PM    

Hello Devexpress ,

having problem for some time downloading your examples
was thinking something wrong with my pc but tried some other still the same thing

ICAP Error (icap_error)

  
 An error occurred while performing an ICAP operation: Maximum file size exceeded; File: GetExample; Sub File: ManageUsersOnLogon.Module\BusinessObjects\ReadMe.txt; Vendor: Kaspersky Labs; Engine error code: 0x00000000; Engine version: 8.1.8.79; Pattern version: 130905.225000.10967985; Pattern date: 2013.09.05 22:50:00
 There could be a network problem, the ICAP service may be misconfigured, or the ICAP server may have reported an error.

 For assistance, contact your network support team.

Added By: Apostolis Bekiaris (DevExpress) at: 9/19/2013 3:35:30 AM    

Implemented in eXpandFramework 13.1.7.1
http://apobekiaris.blogspot.gr/2013/09/how-to-manage-users-register-new-user.html

Added By: Daniele M at: 7/26/2015 3:21:28 AM    

I would like to add a capctha code in this registration page.
how can i do? is there an example?
thanks

Added By: Dennis (DevExpress Support) at: 7/27/2015 2:46:05 AM    

@Daniele: While we do not have a ready E4037 example modification for this particular scenario, you can find the following ASP.NET documentation and reference tickets helpful:
ASPxCaptcha Overview
How to Validate a Captcha On Logon Screen
ASPxCaptcha in login page
How to: Use Custom Logon Parameters and Authentication

Should you experience any implementation difficulties, submit a separate ticket and attach your test project showing what you tried to implement according to this information.Added By: Daniele M at: 9/7/2015 7:31:28 AM    

is it possible to customize the logon form in order to obtain the logon button first of two rows with the button "forgot password" and "create a new user"?

Added By: Daniele M at: 9/7/2015 9:04:38 AM    

is it possible to change label to user name in register user form? I tried with displayname attribute in RegisterUserParameters,cs but it didn't work.
thanks

Added By: Dennis (DevExpress Support) at: 9/8/2015 2:43:16 AM    

@Daniele:
Both things are possible. The Security.Extensions module contains the Model.DesignedDiffs.xafml file with model customizations of the AuthenticationStandardLogonParameters_DetailView node. This node determines what your logon form will look like in the UI. You can customize its layout or change captions of items via the Model Editor designer. Should you experience any further customization difficulties here, please submit a separate ticket, and describe what you tried to do and what did not work as expected. Thanks.

Added By: Daniele M at: 9/25/2015 1:12:51 AM    

I can not integrate the example 3 with https://www.devexpress.com/Support/Center/Example/Details/E2849 to enforce password complexity.
can you help me?
thank you

Added By: Anatol (DevExpress Support) at: 9/25/2015 2:23:18 AM    

Hello Daniele,

To process your recent post more efficiently, I created a separate ticket on your behalf: T293660: How to integrate the E4037 and E2849 examples. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: MohammedFarooq at: 10/9/2015 5:33:10 PM    

Hi Dennis & Anatol,

I have used the is example in my project and it works great.

could you please show how to add an image (mylogo.png for example) on the right top corner of the logon page? It is a png image to show company's logo on the logon page.

Added By: Dennis (DevExpress Support) at: 10/12/2015 3:58:10 AM    @MohammedFarooq:
I am happy to hear of your progress.
>> how to add an image (mylogo.png for example) on the right top corner of the logon page?

Would you please submit a separate ticket and attach a screenshot of the desired UI, because possible solutions will vary a lot based on the exact logo placement?

Added By: MohammedFarooq at: 10/12/2015 8:54:03 AM    

Hi Dennis,

I have created a separate ticket as suggested by you.

https://www.devexpress.com/Support/Center/Question/Details/T299424

Added By: Vishwas Mokashi at: 12/24/2015 3:42:16 AM    

Hello,

I want to implement User Registration in our solution.

<<

Steps to implement
In order to use this module in your project, do the following:
1. Include the module sources into your solution and rebuild it;
>>

What are Module Sources ?  Module.cs?  LogonActionParameters.cs?, ManageUsersOnLogonController.cs? given in this ticket?
where and how to include it in solution?

Added By: Dennis (DevExpress Support) at: 12/24/2015 4:50:41 AM    @Vishwas: I have updated this instruction. Let me know in case of any further questions.Added By: Vishwas Mokashi at: 12/24/2015 6:21:21 AM    

Dennis, thanks I know how to include project but where from to down load?. Or I create new Module project and copy paste the code classes given in this ticket?

Added By: Dennis (DevExpress Support) at: 12/24/2015 6:31:24 AM    

@Vishwas: You can download complete example source code under the Downloads section at the right side of the example webpage. Let me know if you experience any further difficulties here.

Added By: Vishwas Mokashi at: 12/24/2015 6:36:55 AM    

Thanks Dennis, I had done that but problem was I did not have the Sample Runner loaded on my machine and could not extract the files.

Thank you and Merry Christmas!!

Added By: Dennis (DevExpress Support) at: 12/24/2015 7:02:23 AM    @Vishwas: Am I correct that you have now installed the Example Runner and could download this example? If so,  I am happy to hear of your results.
Merry Xmas to you and yours too!Added By: Vishwas Mokashi at: 12/24/2015 7:14:39 AM    

Yes Dennis, I have Sample Runner, could download it and use it also. Thanks...

Added By: Dennis (DevExpress Support) at: 12/24/2015 7:33:15 AM    @@Vishwas: Great!Added By: Ryan Elliott_ at: 5/23/2016 12:31:49 PM    where do I find the Security.Extensions module project?Added By: Dennis (DevExpress Support) at: 5/23/2016 12:35:54 PM    @Ryan: See the download link under the Downloads section on the right side of the example's page.Added By: Ryan Elliott_ at: 5/24/2016 7:45:41 AM    @Dennis - Thanks, I got it downloaded and added to our project.  But we don't have a createUser, all of our user accounts will be created by an Admin on a need basis.  is there anyway to use just the Forgot Password functionality?Added By: Dennis (DevExpress Support) at: 5/24/2016 8:00:40 AM    

@Ryan: Thanks for informing me of your results. Sure, you can modify the downloaded project code and remove anything that you do not need from it (e.g. get started with the ManageUsersOnLogonController class). After all, it is just a Controller with custom Actions and related code/XAFML.

Added By: Ryan Elliott_ at: 5/24/2016 8:23:41 AM    @Dennis - I've commented out the RegisterUserAction code in ManageUsersOnLogonController.cs.  My main issue now is with the Module.cs class, and the lines of code below:

static ModuleNameGoesHere()
{
     SecurityExtensionsModule.CreateSecuritySystemUser = Updater.CreateUser;
}

I get an error for "'Updater' does not contain a definition for 'CreateUser'"  Added By: Dennis (DevExpress Support) at: 5/24/2016 8:24:27 AM    @Ryan: These lines are related to the "register new users" functionality and you can comment them out.Added By: Ryan Elliott_ at: 5/24/2016 9:02:03 AM    @Dennis - I've got those lines removed, but now since I've added the SecurityExtensionsModule to the Module.cs of our Module project, I get the below error in Global.asap.cs - WebApplication.Instance.Start();

An exception of type 'DevExpress.ExpressApp.Model.Core.DuplicateModelNodeIdException' occurred in DevExpress.ExpressApp.v15.2.dll but was not handled in user code


Additional information: There is already node with Id 'RestorePassword'. The node: Application/ActionDesign/Actions/RestorePassword.
Added By: Dennis (DevExpress Support) at: 5/25/2016 1:32:32 AM    

@Ryan: This exception indicates that you have included the Controller with RestorePassword Action twice into your application by a mistake. I guess once into YourSolutionName.Module and once as part of the Security.Extensions module. It is correct to include this functionality only once: either as a part of the Security.Extentions module, whose code you are free to modify, or as a part of your own module. So, remove the duplication and everything will go back to normal. If this does not help, please submit a separate ticket via the https://www.devexpress.com/Support/Center/Question/Create service and attach your problematic sample there.

Added By: Ryan Elliott_ at: 5/25/2016 12:05:18 PM    @Dennis - just created this ticket - https://www.devexpress.com/Support/Center/Question/Details/T383948Added By: MohammedFarooq at: 10/29/2016 11:47:20 AM    Hi Dennis,

Just a silly question, Can we show the RestorePassword or RgisterUser buttons as links instead of buttons?

Can ActionUrl object be used in this case? if yes, then can you please guide me on its usage. Added By: Dennis (DevExpress Support) at: 10/31/2016 5:41:17 AM    

@MohammedFarooq: I've created a separate ticket on your behalf (T445256: How to show the RestorePassword or RgisterUser buttons as links instead of buttons (extending E4037)). It has been placed in our processing queue and will be answered shortly.

How to enable in-place editing in the WinForms tree List View (TreeListEditor)

$
0
0

This example shows how to implement a custom ViewController that gets access to the TreeList control and makes it editable according to the XtraTreeList documentation:
    WinForms Controls > Controls > Tree List > Feature Center > Data Editing
    TreeListOptionsBehavior.Editable Property
    TreeList.ShowingEditor Event
    TreeList.CellValueChanged Event

Take special note that special handling is required for the correct operation of editors for reference properties (e.g., a lookup filtering functionality requires obtaining the currently selected record).
This is not a complete solution and you will need to modify and test this example code further in other scenarios according to your business requirements. For instance, if you require supporting ConditionalAppearance rules, consider using the code from the Q479878 ticket. If you require supporting member-level security permissions, consider extending this example by analogy with the DevExpress.ExpressApp.Win.SystemModule.GridListEditorMemberLevelSecurityController class for GridListEditor.

 

See also:

How to enable in-place editing in the ASP.NET tree List View (ASPxTreeListEditor)
Tree List Editors - How to edit data directly in the tree view (inplace / inline modifications)

Question Comments

Added By: Kerry Busby at: 6/21/2012 10:17:49 PM    

Are there any plans on ever incorporating this into the 'official' code base of XAF. The solution below previously could be manipulated with another controller to support EditorStateRule attributes and disable specific property editors however not that the EditorState module has been removed in DXPerience 2012 this is not possible or at least a LOT more difficult with the new Appearance module. There are a number of posts requesting this previously but currently it appears as if TreeLists with inplaced editing will never be 'officially' supported.

Added By: Willem de Vries at: 12/7/2012 3:11:17 AM    

+1 for Kerry!
DX, do not hesitate to upgrade Xpand gems to the XAF code base.
Willem

Added By: David Perfors at: 3/22/2013 6:17:49 AM    

A nice addition to this example is support for ImmediatePostDataAttribute:
[code lang="cs"]
void treeList_CellValueChanging(object sender, CellValueChangedEventArgs e)
        {
            if (ImmediatePostData(e))
            {
                SetValue(e);
            }
        }

        private void treeList_CellValueChanged(object sender, CellValueChangedEventArgs e)
        {
            if (!ImmediatePostData(e))
            {
                SetValue(e);
            }
        }

        private void SetValue(CellValueChangedEventArgs e)
        {
            object newValue = e.Value;
            if (e.Value is IXPSimpleObject)
                newValue = ObjectSpace.GetObject(e.Value);
            object focusedObject = _treeList.FocusedObject;
            if (focusedObject != null)
            {
                IMemberInfo focusedColumnMemberInfo = ObjectSpace.TypesInfo.FindTypeInfo(focusedObject.GetType()).FindMember(e.Column.FieldName);
                if (focusedColumnMemberInfo != null)
                    focusedColumnMemberInfo.SetValue(focusedObject, Convert.ChangeType(newValue, focusedColumnMemberInfo.MemberType));
            }
        }

        private bool ImmediatePostData(CellValueChangedEventArgs e)
        {
            if (_treeList.FocusedObject != null)
            {
                IMemberInfo focusedColumnMemberInfo = ObjectSpace.TypesInfo.FindTypeInfo(_treeList.FocusedObject.GetType()).FindMember(e.Column.FieldName);
                return focusedColumnMemberInfo.FindAttribute<DevExpress.Persistent.Base.ImmediatePostDataAttribute>() != null;
            }
            return false;
        }
[/code]

Added By: kirsten greed at: 12/3/2016 7:12:36 PM    The code references IXPSimpleObject  but this is not defined

Data Source Wizard - How to hide undesired data providers

$
0
0

This example illustrates how to remove some of the data providers available on the Specify a Connection String wizard page.

The following image illustrates this wizard page with all the data providers removed except for Microsoft SQL Server.

To customize the Data Source and Report wizard pages, do the following.

1. Add a custom service implementing the IWizardCustomizationService interface.

In this example, the Select the Data Source Type wizard page is removed by enabling only the DataSourceType.Xpo setting (corresponding to the Database Connection option).

Then, the CustomizeProviders<TModel> method is called, which assigns a custom list of data providers to a corresponding ISqlDataSourceModel object.

2. Register the created service by calling the XRDesignMdiController.AddService method.


See also:
For a general code example on how to customize the Data Source Wizard using the IWizardCustomizationService interface, see How to customize the New Report Wizard (introduced in the 2014 vol.1 release) in the End-User Designer.

Data Source Wizard – How to Replace the Standard Query Builder

$
0
0

This example illustrates how to customize the standard Query Builder dialog of a Data Source Wizard.

The following image illustrates a custom form replacing the standard Query Builder.



The standard Query Builder dialog is initialized and displayed by the Create a Query or Select a Stored Procedure wizard page.

To substitute the Query Builder, do the following.

1. Override the RunQueryBuilder virtual method of this page's presenter (MultiQueryConfigurePage<TModel>).

In this method's body, implement the logic required to display a custom Query Builder form and obtain the results of the Query Builder execution.

2. To register a custom query configuration form, implement the IWizardCustomizationService interface.

To invoke the custom query customization form instead of the default Query Builder, implement the ISqlEditorsCustomizationService interface.


3. Add the custom services to the Report Designer by calling the XRDesignMdiController.AddService method at the application startup.

 

See also:

For a general code example of how to customize the Data Source Wizard using the IWizardCustomizationService interface, see How to customize the New Report Wizard (introduced in the 2014 vol.1 release) in the End-User Designer.

How to hide pivot grid columns

$
0
0

The following example demonstrates how to hide particular columns.
In this example, the CustomFieldValueCells event is handled to remove the Grand Total column if there are no fields located in the Column Area.


How to: manually generate map items for location information received from the Bing Search provider

$
0
0
This example demonstrates how to manually process location information received from the Bing Search data provider.
Question Comments

Added By: Joe Pool at: 12/6/2016 1:22:29 PM    Is there a way to provide an address and get back the Latitude/Longitude coordinates?Added By: Alex (DevExpress Support) at: 12/6/2016 10:14:00 PM    Hi Joe,

Use the BingSearchDataProvider to determine a particular address location. Please refer to the sample project provided in the How to find route by entering target locations' names or addresses ticket and let us know if you need further assistance.

How to create custom shapes with custom connection points for DiagramDesignerControl

$
0
0

The Diagram control supports a special language for defining shapes. The main element that contains shape description is ShapeTemplate. This element describes a shape contour and may contain several segments:
- Start. Specifies the start point
- Line. Defines a line with start and end points
- Arc. Defines an arc with start and end points

To specify connection points, use the ShapeTemplate.ConnectionPoints property.
To register custom shapes, create a stencil with the DiagramStencil.Create method and pass it to the DiagramToolboxRegistrator.RegisterStencil method.

How to: Create Items with Custom Content in DiagramControl

$
0
0

Simple shapes in DiagramControl display only their content as an editable string. If it's necessary to add custom elements to diagram items, use the DiagramContentItem class. DiagramContentItem has the ContentTemplate property, which can be used to put any elements into the item.

[XAML]
<Stylex:Key="formattedTextContentItem"TargetType="dxdiag:DiagramContentItem"><SetterProperty="ContentTemplate"><Setter.Value><DataTemplate> ...</DataTemplate></Setter.Value></Setter></Style>

To register DiagramContentItem in the toolbox, use the DiagramStencil.RegisterTool method with FactoryItemTool as a parameter:

[C#]
stencil.RegisterTool(newFactoryItemTool("Calendar",()=>"Calendar",diagram=>newDiagramContentItem(){CustomStyleId="formattedTextContentItem"},newSize(230, 110),true));

After that, register the stencil using DiagramToolboxRegistrator.RegisterStencil.
Please note that to properly deserialize DiagramContentItem, it's necessary to set its CustomStyleId property, which accepts a key of a Style applied to the item.

How to use DXGrid in Server Mode with Entity Framework 4.0+

How to hide navigation items based on the current user

$
0
0

Scenario:


Our Security System allows hiding navigation items for certain users by setting the Type Permission's Navigate access. Since with this approach, the Navigate access can be granted only for a certain type, the following scenarios are not supported:

1. It is necessary to hide a DashboardView.
2. There are several navigation items for a certain type, and it is required to hide a part of them.
3. It is necessary to hide a navigation item that is not associated with a certain View (e.g., a navigation group).


This article demonstrates how to extend the security role class with the HiddenNavigationItems property allowing hiding navigation items by their ID.

Steps to implement:

1. Implement a custom permission type - NavigationItemPermission - that can be used to check access permissions for a certain navigation item by its ID.
2. Implement a custom permission request - NavigationItemPermissionRequest - that will be sent to check whether the current user has access to a certain navigation item.
3. Implement a custom permission request processor - NavigationItemPermissionRequestProcessor - that determines whether the current user has permissions for the received permission request.
4. Implement a custom role with the HiddenNavigationItems property. Extend it with the GetPermissions method to create NavigationPermission instances based on the value of the HiddenNavigationItems property.
5. Specify the custom role in the Security System's RoleType property in the Application Designer, as described in the How to: Implement Custom Security Objects (Users, Roles, Operation Permissions) topic.
6. Register your permission request processor in the application by handling the SecurityStrategy.CustomizeRequestProcessors event in the Program.cs and Global.asax.cs files.
7. Implement a ShowNavigationItemController's descendant - CustomShowNavigationItemController - and override its SynchItemWithSecurity method to deactivate navigation items prohibited by the CustomSecurityRole.HiddenNavigationItems property.

After implementing these steps in your project, you will be able to assign a role with the HiddenNavigationItems property to the required users to restrict their access to certain navigation items.

Note: The example is based on the PermissionPolicyRole and PermissionPolicyUser classes. These classes are used by the Security System when selecting the Allow/Deny permissions policy in the Solution Wizard. If your project was created using an earlier XAF version (prior to 16.1) and the SecuritySystemRole and SecuritySystemUser classes are used in it, change the version number in the combo box below to see an example for these classes.

Question Comments

Added By: Maurice Picton at: 6/10/2014 7:52:32 AM    

Can someone post the HideNavigationItemsExample that is mentioned below in the code?
I'm having trouble implementing this solution.

Added By: Maurice Picton at: 6/10/2014 8:00:46 AM    

In the steps to implement, none of the entities you describe are in any of the documentation and I can't locate them in visual studio.

Added By: Anatol (DevExpress Support) at: 6/10/2014 8:07:44 AM    These classes are implemented in this example. You can see their code below, under the comments. To download the complete example, use the Downloads - Example link at the right edge of this page.Added By: Randy Jean at: 2/13/2015 11:15:42 AM    

Is there a way to make this be least restriction has precedence.  For instance, if I have a users role that hides navigation items and a direct role that does not hide, can the director role take precedence over the user role somehow?

Added By: Randy Jean at: 2/13/2015 11:33:21 AM    

think I may have come up with a way to make this work.  If I add a wildcard * to my HiddenNavigationItem then modify the IsGranted like so:

       public override bool IsGranted(NavigationItemPermissionRequest permissionRequest) {
           foreach (NavigationItemPermission permission in permissions.GetPermissions<NavigationItemPermission>()) {
               if (permission.HiddenNavigationItem == permissionRequest.NavigationItem) {
                   return false;
               } else if (permission.HiddenNavigationItem.Replace("*","") == permissionRequest.NavigationItem) {
                   return true;
               }
           }
           return true;
       }

This seems to do what I want.  So I can have user with the restrictions but then override in Director with the wildcard character like this: AddressGroup*, Person_Varied*

Do you see any issues with this?

Added By: Anatol (DevExpress Support) at: 2/16/2015 6:16:18 AM    

I am not sure that this approach will work in all cases, since the GetPermissions method returns permissions from all user roles, and with your implementation the first permission always wins. So, it is better to set a boolean variable based on the permission's HiddenNavigationItem property and return this value after processing all NavigationItemPermission permissions.

Added By: Genesis Supsup 1 at: 8/7/2016 12:48:08 PM    This example doesn't seem to work anymore on when using  PermissionPolicyRoleBase in version 16.1+ ... any workaround?Added By: Anatol (DevExpress Support) at: 8/9/2016 1:15:00 PM    I have updated the example - now it uses the PermissionPolicyRole and PermissionPolicyUser classes. The PermissionPolicyRole class does not have the GetPermissionsCore method, so it was necessary to add this method to the CustomSecurityRole class and call it in the SecurityStrategy.CustomizeRequestProcessors event handler to collect permissions of the current user manually.
Viewing all 7205 articles
Browse latest View live


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