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

OBSOLETE - How to show custom forms and controls in XAF (Example)

$
0
0

==============================
This article is now obsolete. Instead, refer to the eXpressApp Framework> Concepts> UI Construction> Using a Custom Control that is not Integrated by Default overview article and the following two help topics in particular:
    eXpressApp Framework> Task-Based Help> How to: Show a Custom Data-Bound Control in an XAF View (WinForms)
    eXpressApp Framework> Task-Based Help> How to: Show a Custom Data-Bound Control in an XAF View (ASP.NET)
    Concepts > UI Construction > Views > Ways to Show a View 
    How to: Show a Custom Windows Form
    How to: Show a Custom Window with an Embedded XAF View
    Ways to Show a Confirmation Dialog 

==============================
This example implements the following scenarios when an end-user clicks on a custom item in the navigation control:

- a custom non-XAF form is opened as a result;

- a standard XAF View containing a custom user control is opened as a result.


Both custom forms and user controls display persistent data from the XAF application database. For that purpose, this example solution provides a set of reusable elements (custom ViewItem and Application Model extensions) organized in a way that you can once implement them in an XAF module and reuse to display custom user controls in various forms.


IMPORTANT NOTES
If you do not require a complex and reusable solution for this task, it is recommended to use a much simpler and built-in XAF solution - ControlDetailItem placed within a DashboardView. This item can be added and customized as described at eXpressApp Framework > Task-Based Help > How to: Create a Custom Control Detail Item. See also the Using a Control that is not Integrated by Default article for other integration options.

If this is NOT your case, proceed to the instructions below.

STEPS TO IMPLEMENT

1.
Define a base structure of the navigation control in your XAF application, as shown in the E911.Module\Model.DesignedDiffs.xafml file.

You can simply copy and paste the contents of the NavigationItems element into the corresponding file (pre-opened via the text editor) of your platform-agnostic module.

The same customizations can be achieved via the Model Editor visually.
Take special note that you can set the View parameter to any View from the list, e.g. AboutInfo_DetailView, BaseObject_ListView, etc.

This navigation structure will be further customized in the WinForms and ASP.NET executable projects later.


2. Intercept events of the navigation control to display a custom form when a custom navigation item is clicked.

To do this, implement a WindowController into your platform-agnostic module and handle events of the ShowNavigationItemController class as per the E911.Module\Controllers\ShowCustomFormWindowController.xx file. This controller will be abstract and be overridden in WinForms and ASP.NET modules.


3. Declare a custom ViewItem class that is supposed to host a custom user control in the standard XAF View. To do this, implement a custom ViewItem descendant and related types in the platform-agnostic module as shown in the E911.Module\Editors\CustomUserControlViewItem.xx file.

This ViewItem will also be abstract and platform-agnostic as it will not create platform-dependent controls, and will just provide a common customization code for both platforms. For instance, the OnControlCreated method will be overridden to bind the created control to data. To access persistent data from the database used by an XAF application, the ViewItem will implement the IComplexViewItem interface that consists of a single Setup method, receiving the IObjectSpace and XafApplication objects as parameters.

To unify our data binding code for both platforms, the IXpoSessionAwareControl interface and an auxiliary XpoSessionAwareControlInitializer class are introduced.

The interface provides a single UpdateDataSource method that is implemented by custom forms and user controls to bind them to data received by means of XPO.

You can use a similar mechanism and modify these auxiliary types to pass other custom data into your custom forms and controls.


4. Define a base structure of the standard XAF View with a custom ViewItem as shown in the E911.Module\Model.DesignedDiffs.xafml file.

You can simply copy and paste the contents of the Views element into the corresponding file (pre-opened via the text editor) of your platform-agnostic module.


5. Create custom forms and user controls in WinForms and ASP.NET executable projects analogous with what is shown in the example. The easiest way to do this is to copy the contents of the E911.Win\Controls and E911.Web\Controls folders and then include the necessary files into your solution. Take special note that these custom forms and controls implement the IXpoSessionAwareControl interface to automatically receive persistent data and other parameters when they are created.


6. Implement platform-dependent behavior to open and customize custom forms and controls. To do this, copy the following files into your WinForms and ASP.NET module projects:

WinForms:

E911.Module.Win\Controllers\WinShowCustomFormWindowController.xx - contains an WinForms version of the WindowController, which is inherited from the platform-agnostic

E911.Module.Win\Editors\WinCustomUserControlViewItem.xx - contains an WinForms version of the ViewItem, which is inherited from the platform-agnostic one;

E911.Module.Win\WinModuleEx.xx - contains a registration code for WinForms version of the ViewItem;


ASP.NET:

E911.Module.Web\Editors\WebCustomUserControlViewItem.xx - contains an ASP.NET version of the ViewItem, which is inherited from the platform-agnostic one;

E911.Module.Web\WebModuleEx.xx - contains a registration code for ASP.NET version of the ViewItem;

E911.Module.Web\Controllers\WebShowCustomFormWindowController.xx - contains an ASP.NET version of the WindowController, which is inherited from the platform-agnostic one;


These platform-dependent versions of the WindowController and ViewItem are required to implement the creation and display of custom forms and controls using the means specific for each platform. They are also designed to provide the capability to be able to set custom forms and control settings via the Model Editor. For that purpose, custom Application Model extensions are implemented for the Navigation Item and View Item model elements.


7. Set the custom forms and controls settings for each platform.

To do this, copy the contents of the E911.Win\Model.xafml and E911.Web\Model.xafml files into the Model.xafml file in the executable WinForms and ASP.NET projects:

WinForms:

ASP.NET:

 

OTHER IMPLEMENTATION CONSIDERATIONS

1. It is also possible to mix the traditional and XAF development approaches (consult our Support Team if you are not sure how to integrate your standard non-XAF solution into XAF), because an XAF application is a regular .NET application built of reusable blocks like View, ViewItem, Property and List Editors, etc. that eventually create and customize platform-dependent controls exactly the same way you do this without XAF. So, using XAF does not mean something absolutely new and allows you to reuse your existing development skills and practices. Of course, it is possible to create your own reusable blocks if the standard ones do not meet your needs. For instance, the example of a custom View class designed to show a custom form can be found on CodeProject here.


2. This solution contains some generic code (e.g., base WindowController and ViewItem) that is mainly required because our XAF application is for both Windows and the Web. You may avoid this generic code and make a simpler implementation if you are developing for only one platform.


3. You can display custom forms not only when interacting with the navigation control, but from any other place. To do this, intercept the events of a required entity, e.g., an XAF Controller, Action or a View. Refer to the product documentation or consult with our Support Team in case of any difficulties.


4. By default controls layout and user customizations are preserved only for built-in XAF ListEditors, because they have special code for that. If you embed a custom user control into XAF, you need to preserve its settings yourself as well, exactly like you would do when implementing this task in the "old way" in a non-XAF application. Refer to the control's documentation to learn more on how to accomplish this task.

Feel free to contact the respective product team if you experience any difficulties customizing this control.


See also:
How to create controls dynamically
How much of XAF's default UI is customizable.
How to Show a Window via an Action
How to: Display a List of Non-Persistent Objects
How to: Display a Non-Persistent Object's Detail View from the Navigation
ShowNavigationItemController.CustomShowNavigationItem Event
XafApplication.CustomProcessShortcut Event

Question Comments

Added By: kenngo at: 11/6/2012 2:24:10 AM    

Hi, I would like the custom from to be tabbedMDI, how to set this in the controller class?

Added By: Dennis (DevExpress Support) at: 2/1/2013 6:12:45 AM    

@Ngo Ken Hui:
Refer to the Q391718 ticket that describes a possible solution.

Added By: Alan mahone at: 4/26/2013 8:39:40 AM    

i have a problem in CustomUserControlViewItem.cs file
 in line "new XpoSessionAwareControlInitializer(Control as IXpoSessionAwareControl, theObjectSpace);"
the Control is converted to null

Added By: Dennis (DevExpress Support) at: 4/26/2013 8:43:18 AM    

Please submit a new ticket and attach your problematic project there:
http://www.devexpress.com/Support/Center/Question/Create
We will be glad to help you.

Added By: Andrew Bingham 2 at: 6/5/2013 10:11:58 AM    

The downloaded solution states it is for " v13.1".

The latest version I am aware of is 12.2?

Added By: Carl Howarth 1 at: 10/11/2013 4:00:36 AM    

Just in case anyony else hits the issue where the model.CustomControlTypeName is null; there are some additional model settings that are not included in the example code below (but are in the actual download).

Have a look at the XML for the E911.Module.Win/Web Model.xafml. You will notice that there are settings within these files that are not detailed below (it may be obvious to some based on the article but I missed it and it cost me the best part of a day).

Win version:
<Application>
  <NavigationItems>
    <Items>
      <Item Id="Default">
        <Items>
          <Item Id="CustomForm" CustomFormTypeName="E911.Module.Win.Controls.WinCustomForm" />
        </Items>
      </Item>
    </Items>
  </NavigationItems>
  <Views>
    <DashboardView Id="StandardFormWithCustomUserControl">
      <Items>
        <CustomUserControlViewItem Id="CustomUserControlViewItem" CustomControlTypeName="E911.Module.Win.Controls.WinCustomUserControl" />
      </Items>
    </DashboardView>
  </Views>
</Application>

Web version:
<Application>
  <NavigationItems>
    <Items>
      <Item Id="Default">
        <Items>
          <Item Id="CustomForm" CustomFormPath="Controls/WebCustomForm.aspx" />
        </Items>
      </Item>
    </Items>
  </NavigationItems>
  <Views>
    <DashboardView Id="StandardFormWithCustomUserControl">
      <Items>
        <CustomUserControlViewItem Id="CustomUserControlViewItem" CustomControlPath="Controls/WebCustomUserControl.ascx" />
      </Items>
    </DashboardView>
  </Views>
</Application>

Hope this helps.

Cheers

Carl

Added By: Daniele M at: 2/3/2015 1:43:31 AM    

is it possible to call this windows by action and pass it an object id?
if yes, how can I do?

Added By: Dennis (DevExpress Support) at: 2/3/2015 1:54:50 AM    @Deniele: Sure, that is possible. Check out the following product documentation to learn more on how to implement these tasks:
eXpressApp Framework > Task-Based Help > How to: Access Objects Selected in the Current View
eXpressApp Framework > Concepts > Extend Functionality > Show a Window via an Action
View.Tag Property
Please create a separate ticket in the Support Center and attach your test project if you experience any implementation difficulties.Added By: Farooq at: 4/13/2015 11:39:25 PM    

Hi,

Could you please provide the sample project in VB as well. It is difficult to reproduce the project by the below VB code.

Added By: Farooq at: 4/14/2015 12:10:00 AM    

I get an error in WinShowCustomFormWindowController controller when executing

Dim form As Form = TryCast(DevExpress.Persistent.Base.ReflectionHelper.CreateObject(customFormTypeName), Form)

The error says: "Unable to cast object of type 'ModelNavigationItem' to type 'Solution3.Module.Win.IModelWinCustomFormPathNavigationItem'."

Added By: Dennis (DevExpress Support) at: 4/14/2015 4:00:07 AM    

@MohammedFarooq: There is already a VB.NET version of this example here. Please scroll to the bottom and select your programming language in the drop-down box and then click the Downloads | Example link at the top right.
To avoid the error you received, it is important to follow the instructions from the 6th point.


ASP.NET Core Dashboard Control - How to specify a default dashboard state in code

$
0
0

The sample illustrates how to specify a dashboard state (such as master filter or parameter values) in code and how to apply this state when loading a dashboard for the first time. In this example, the DashboardState object defined in the Controller holds the required dashboard state. The MVC approach is used to pass the specified dashboard state to the View's DashboardBuilder.InitialDashboardState property and use this state on loading a dashboard.

How to edit Nullable field with the ASPxGridView and ASPxImage in EditItemTemplate

$
0
0

Starting with version 2011.1:
I recommend that you use ASPxCheckBox instead of the demonstrated solution since the control supports the Undefined (Grayed) checked state, see ASP.NET Check Box - New Render State For Multiple Controls for details.


Prior version 2011.1:
The example demonstrates how to edit the Boolean field that allows writing "null" values (Nullable<Boolean>, Boolean?).
As the standard checkbox doesn't allow having three states (checked, unchecked and gray), the scenario can be implemented with the ASPxImage and three images. The images are taken from the default CSS sprite used by the ASPxEditors suite.

How to override the standard browser's shortcut

$
0
0
This sample demonstrates why and how you can use the ASPxClientUtils.PreventEventAndBubble client method when implementing your application's client logic.
Note that the sample code uses a couple of client utility methods - GetShortcutCodeByEvent and StringToShortcutCode - making it easy to work with shortcut codes on the client.
The use of the ASPxWebControl.RegisterBaseScript server static method is also demonstrated.

How to obtain a specific section content

$
0
0

This example illustrates how to obtain the content of a Section which the caret position belongs to. There is no direct method to obtain the section range. However, you can construct this range based on section paragraphs:

 

[C#]
...DocumentPositioncurrentSectionStart=currentSection.Paragraphs[0].Range.Start;DocumentPositioncurrentSectionEnd=currentSection.Paragraphs[currentSection.Paragraphs.Count- 1].Range.End;...

 

After that you can use the SubDocument.GetText Method to obtain the section content.

Upd. Starting from the v18.1.4, the RichEditControl is provided with the Section.Range property to obtain the section range. 

In addition, we illustrate how to calculate the current section and paragraph index.

See Also:

SubDocument essentials - simple examples

How to reset page numbering on a specific page

How to apply different headers/footers to different pages

How to merge documents with headers and footers into a single document

How to customize an XPO business model at runtime (Example)

$
0
0

Sometimes there is a requirement to extend existing business classes from other libraries, add new members, etc.

For instance, you have an assembly where you have declared your persistent classes. Now, you want to use these classes in your XAF application.

Note that to use the types from external assemblies, you should add them to your business model. To do that, you should use the Business Classes section of the Module Designer.


For instance, to force XAF to create navigation items for business classes, usually you can mark them with the DevExpress.Persistent.Base.DefaultClassOptionsAttribute, but what to do if your classes "live" in a separate assembly, which has no references to DevExpress.ExpressApp assemblies.

What to do? In this instance, the XafTypesInfo / XPDictionary customization may be helpful. Currently in XAF using this approach, you can add new attributes to your classes and their members, declare new associations, etc. The only thing, which is not currently supported in XAF, by default, is the capability to declare new classes "on the fly" via customization of the XafTypesInfo / XPDictionary. 

IMPORTANT NOTES

1. By design you cannot dynamically add or remove the OptimisticLocking and DeferredDeletion attributes.
2. Adding custom members for Domain Components (DC) should be done on the XafApplication.SettingUp event as described at How do I define a custom member for a domain component (DC) at runtime?. Do not mix the Domain Components (DC) technology with Non-Persistent Objects. This functionality is unsupported for POCO marked with the DomainComponentAttribute. If you attempt to call the ITypeInfo.CreateMember method for such a POCO, you will receive a meaningful exception. Refer to the How to create custom/dynamic properties for a non-persistent POCO marked with DomainComponentAttribute article for possible solutions.

3. For XAF versions older than 15.1.4 you cannot dynamically establish an association between two persistent classes via the XafTypesInfo API. Use the XPDictionary API instead as shown in this example. Starting with v15.1.4, use the solution described in the eXpressApp Framework > Concepts > Business Model Design > Types Info Subsystem > Customize Business Object's Metadata > Create Associations in Code article.


See also:
How to: Access Business Class Metadata

Question Comments

Added By: Denis Sikic at: 11/15/2013 5:58:17 AM    

Update the MyXPOClassLibrary project from Framework 3.0 to 4.0, in order to compile.

OBSOLETE - How to: Store Model Differences in Database

$
0
0

========================================================================
Starting with v14.2, the database storage is supported out-of-the box (see How to: Store the Application Model Differences in the Database and How to: Enable the Administrative UI for managing Users' Model Differences ). You should not use this example in a new project.
========================================================================

This example illustrates how to store user UI settings (so-called model differences) in the application database instead of the file system (in Windows Forms applications) and session (in ASP.NET appications).

By default, an XAF Windows Forms application stores user customizations of the Application Model in the Model.User.xafml file, located in the application's directory. The application's model difference storage is also file-based (Model.xafml file). These two layers are superimposed when running an application. All model-related changes made by the end-user (e.g., layout customizations) are saved to the Model.User.xafml. The potential disadvantages of this default approach are:


- The Model.xafml file is not shared (except when the application is deployed to the terminal server). So even if this file is modified by an administrator, it must be re-deployed to all users to take effect;

- Since model differences are stored in a plain XML format, anyone who has access to XAFML files can easily influence the work of the application. So, it is possible to affect a critical setting that will cause the application to stop functioning;

- Several users sharing the same copy of the application cannot have individual customizations. This can be resolved by changing the user differences file location to the user profile folder (by setting the UserModelDiffsLocation key value to the CurrentUserApplicationDataFolder in the application configuration file). However, the problem persists if users are working under the same system account.

By default, an XAF ASP.NET application stores user customizations of the Application Model in the session. The global application model difference storage is file-based (Model.xafml file located in the web application folder). These two layers are superimposed when running an application. All model-related changes (e.g., columns order and visibility in List Views, dashboard layouts, etc.) made by end-users are saved to cookies. If a user accesses the ASP.NET application via several different devices (desktop, laptop or tablet), settings are not synchronized.


Generally, you can use the default storage in most scenarios. However, the disadvantages listed above become critical if you wish to give more power to application administrators and enhance application security. This example provides a solution that eliminates all these disadvantages. The main idea is to store all model differences in the application's database. Follow the instructions below to use the database model difference storage in your XAF application.

 

Build the DatabaseUserSettings.dll Assembly

- Download the solution attached to this example.

- Upgrade the downloaded solution up to your currently installed version of DXperience. Use the Project Converter utility for this purpose.

- Open the converted solution in Visual Studio. Switch to the Release configuration and build the DatabaseUserSettings project (this project contains the module that we are going to use).

- Copy the DatabaseUserSettings.dll assembly to an appropriate location in your development workstation.


Add the DatabaseUserSettings Module to Your XAF Solution

- Open your XAF solution that will use the DatabaseUserSettings module.

- Add the DatabaseModelStrorage.dll reference to the platform-agnostic module project.

- Right-click the Module.cs file and choose View Code. Modify the module's constructor in the following manner.

          

[C#]
publicsealedpartialclassMySolutionModule:ModuleBase{publicMySolutionModule(){InitializeComponent();this.RequiredModuleTypes.Add(typeof(DatabaseUserSettings.DatabaseUserSettingsModule));}}

Note:Alternatively, you can add the DatabaseUserSettings in the Module Designer.But you should register the DatabaseUserSettingsModule toolbox item first (see How to: Add Items to the Toolbox).

Now you can logon using different credentials and apply different customizations for each user. For instance, you can change the active skin for each user. Different users will have different skins selected after the application is restarted. Users should have read/write access to the XPUserSettings and XPUserSettingsAspect persistent types (these types are provided by the DatabaseUserSettings module and are used to store model differences).

The Configurator Account

To manage default model settings applied to users, a special Configurator account can be used. All customizations made by Configurator in the Model Editor or directly in the UI will be stored to the shared Application Model layer. To create such an account, do the following.


- Add a Role named "Configurator" (this name is declared by the DatabaseUserSettingsModule.ConfiguratorRoleName constant).

- For the added Role, grant full access to the XPUserSettings and XPUserSettingsAspect persistent types and read access to the UserName member of the type that represent users in your application (SecuritySystemUser by default). Alternatively, you can simply mark this role as administrative (see SecuritySystemRoleBase.IsAdministrative).

- Add a User named "Configurator" (this name is declared by the DatabaseUserSettingsModule.ConfiguratorUserName constant), and associate this user with the "Configurator" role.

Refer to the Updater.cs file to see the code.

The ManageUserSettings Action

The Configurator user has access to the ManageUserSettings Action. This Action of the PopupWindowShowAction type is provided by the ManageUserSettingsWindowController Controller implemented in the DatabaseUserSettings module. This Action is intended to import a user setting from one user to another.

See Also
Core - Provide an easy way to store administrator and user model differences in a custom store (e.g., in a database)
A reusable XAF module for storing model settings in the database (security system type insensitive!)

ImportantNotes
1.
Be aware of the following issue with this example: User settings may be duplicated/overridden under certain circumstances after merging configurator and user settings applied to the same element
2. This example solution is not yet tested in the middle-tier and SecuredObjectSpaceProvider scenario and most likely, it will have to be modified to support its specifics.
3. This example solution is not yet tested with custom fields.

Question Comments

Added By: Pawel Botwina at: 5/20/2012 6:35:40 AM    

Hi,

Not working with DbUpdater 11.2.

Ticket: http://www.devexpress.com/Support/Center/Question/Details/Q400938

Added By: Sandro Welter (Intelligix) at: 7/6/2012 10:14:37 AM    

Hi,

I need this example in 12.1 version. Thanks.

Added By: Robert Fuchs at: 7/11/2012 8:25:44 AM    

> Take special note that it is important to grant write permissions for
> your persistent model differences classes to the anonymous user:

AFAIR the new security system does not need an anonymous user any more?

Added By: Miles at: 7/12/2012 12:44:42 PM    

12.1 version please!

Added By: Frank (DataJunxion) at: 8/10/2012 11:00:41 PM    

12.1 version?

Added By: John Botibol at: 9/12/2012 1:09:39 AM    

Hi Guys, the Issue (Q421353) mentioned above as one to be aware of is marked as private so this is quite tricky!

Added By: Paolo Parente at: 10/31/2012 7:21:27 AM    

Hi, is there a way to download the whole solution, without select every single file?
Thanks,
Paolo

Added By: Paolo Parente at: 11/2/2012 11:13:32 AM    

Ok, i did it.
But now i've a question: i can i deploy the new Model.xafml when a new version of the application has been developed?
Thanks,
Paolo

Added By: Markus Hoevermann at: 11/5/2012 1:03:53 AM    

I have the same problem as Paolo: How to handle the case when a new softare version with another Model.xafml must be distributed? Is there a ay to do this?

Added By: Dennis (DevExpress Support) at: 11/6/2012 12:03:35 PM    

I have answered your question about deploying the new version in http://www.devexpress.com/Support/Center/Issues/ViewIssue.aspx?issueid=Q443198

Added By: Robert Fuchs at: 12/15/2012 10:38:45 AM    

http://www.devexpress.com/issue=Q421353 is still private.
Is it fixed in the 12.2 example?

Added By: Nektarios Patelis at: 12/28/2012 12:09:23 AM    

Iuse linq queries and Custom fields on model.xafml following http://www.devexpress.com/Support/Center/Example/Details/E859. I get exception on project start up: An error with number 1009 has occurred.
Error message: Error occurs while adding the 'FieldName_Linq' custom property ('System.Double' property type) to the 'MyClassName' type: 'Object reference not set to an instance of an object.'

Added By: Dennis (DevExpress Support) at: 1/29/2013 6:43:43 AM    

Guys, please refer to the public http://www.devexpress.com/issue=Q470416 ticket instead of the private Q421353 one.

Added By: Mr292 at: 1/30/2013 5:44:44 PM    

Dennis, Thanks a lot for this. I had implemented something similar before but I have now moved to your code so as to take advantage of any future changes.

I have a few questions though

1. Does the Model.xafml in the Program Folder get hit at all? It does not seem like it from the code, but wanted to be sure.
2. I had implemented a feature where on exit, the configurator would be prompted to store changes. I have modified this to do the same but in my implementation, the user was being prompted twice. This I have noticed is an issue with a lot of functions in XAF but is usually solvable easily. In this instance, what should I check for to disable the consecutive prompt?
3. Lastly, Just so some users are aware I was having issues saving Chart/Pivot Settings as XML in MySQL if I use latin1 in innodb. Not your fault but I had implemented a BLOB save instead to get over that.

Added By: Vitaly Alekseev (Sibintek) at: 3/26/2013 10:44:39 PM    

How can I logon by Configurator user, if domain authentication used?

Added By: Nate Laff at: 4/12/2013 8:09:31 AM    

Implemented this yesterday after using the example of this from a long time ago (admin mode) and overall I like it.

Administrator users in my opinion shouldn't be able to see the User Settings navigation item. Unfortunately Q485525 prevents this from happening easily. Or am I missing something that this should be visible to Administrator. Seems like only Configurator should see it.

Added By: Nate Laff at: 4/16/2013 2:29:56 PM    

Also, this has been an issue since the first iterations of this. If you make changes to the Win model at the highest level (Model.xafml) such as moving the location of MyDetails, these changes always get messed up. In the current scenario, MyDetails shows up in the navigation group I specified, but also gets duplicated in the default group after you logon with the Configurator user. Does this happen to anyone else?

Added By: Nate Laff at: 4/16/2013 3:03:33 PM    

Also, what's the process here? Let's say you want to make a global change to a view as Configurator..

Log on as Configurator
Make changes
Exit
Log on as Configurator
Manage User Settings action, import from source Configurator to all users
Exit
Log on as User
Verify changes

Is that the process? Am I missing something. The exits are required?

Also, you can't reset to defaults without opening Model Editor as configurator, resetting there, exiting, manage user settings and import from Configurator source again?

Just trying to make sure I have this process down correctly.

Added By: Nate Laff at: 5/2/2013 11:06:59 AM    

Dennis?

Added By: zacarias de prado habela at: 7/26/2013 4:31:49 AM    

Hi:
Where is "XPManageUserSettingsParameter", "XPUserSettings", XPUserSettingsAspect defined?
Thanks

Added By: Dennis (DevExpress Support) at: 7/26/2013 4:41:35 AM    

These classes are defined in the DatabaseUserSettings module. Use the Visual Studio search facilities to locate them...

Added By: Gabriel at: 9/24/2013 10:54:17 AM    

My happy day :D

Added By: Carlitos at: 1/4/2014 5:32:43 PM    

Quick question on the IMPORTANT NOTES:
1 - the bug was corrected right?
2 - Will there be a middle-tier and SecuredObjectSpaceProvider example?

Thanks

Carlitos

Added By: Desire Larue at: 9/30/2014 8:49:04 AM    

I have made this work with my Win app in multi-tier using remoting, how can I make it work for ASP.NET web app

Added By: Dennis (DevExpress Support) at: 9/30/2014 8:54:01 AM    

@Elvis: Exactly the same approach should be used for the Web app. What does not work for you in a Web app, or what can't you implement there? 

Added By: Desire Larue at: 10/30/2014 12:33:54 AM    

In Web App it seems that the changes are not saved to the database for any of the users. Works fine in Win App

Added By: Desire Larue at: 10/30/2014 12:36:35 AM    

Also after making changes in Win App, Web App does not pick up the changes of same user when login

Added By: Dennis (DevExpress Support) at: 10/30/2014 7:38:54 AM    

@Elvis:

Thanks for your feedback. There was a small configuration issue for the security system in the DatabaseUserSettingsModule class:

        public static SecuritySystemTypePermissionObject CreateUserSettingsAspectPermissions(IObjectSpace objectSpace) {
            SecuritySystemTypePermissionObject userSettingsAspectPermissions = objectSpace.CreateObject<SecuritySystemTypePermissionObject>();
            userSettingsAspectPermissions.TargetType = typeof(XPUserSettingsAspect);
            userSettingsAspectPermissions.AllowCreate = true;
            userSettingsAspectPermissions.AllowWrite = true;
            userSettingsAspectPermissions.AllowRead = true;
            return userSettingsAspectPermissions;
        }
        public static SecuritySystemTypePermissionObject CreateUserSettingsPermissions(IObjectSpace objectSpace) {
            SecuritySystemTypePermissionObject userSettingsPermissions = objectSpace.CreateObject<SecuritySystemTypePermissionObject>();
            userSettingsPermissions.TargetType = typeof(XPUserSettings);
            userSettingsPermissions.AllowCreate = true;
            userSettingsPermissions.AllowWrite = true;
            userSettingsPermissions.AllowRead = true;
            return userSettingsPermissions;
        }

The lines that need to be added are highlighted above.

Added By: Konstantin B (DevExpress) at: 11/19/2014 5:00:45 AM    Since v14.2, the database storage is supported out-of-the box. Use this example with older versions only.

See also:
User Settings Stored in the Application Database
Core - Provide an easy way to store administrator and user model differences in a custom store (e.g., in a database) 

How to reorder XtraTreeList nodes via drag-and-drop

$
0
0

This example demonstrates how to handle the DragOver and DragDrop events of the TreeList control to programmatically reorder nodes. The A342 article describes the approach used here.

See Also:
E415

Search keywords: 
TreeList, drag-drop in TreeList, TreeList drag-drop, TreeList drag nodes, TreeList drag and drop nodes


OBSOLETE - How to prevent removing a master record referenced by other records

$
0
0

This example demonstrates how to implement your classes, to save the referential integrity of your tables when removing master objects being referenced by other objects. This solution is appropriate when you have the Deferred Deletion feature of XPO turned off. Without the code in this example, you will get an SQLException. This solution will allow you to provide your users with more meaningful exceptions, when such a situation takes place.

The Master object in this example has an aggregated One-To-Many relationship to Child objects. If a Master object has some aggregated children, it can be immediately deleted with all associated Child objects. However, if there is a Neighbour object, having a reference (without association) to this Master object, the code will raise an exception, notifying about existing referencing objects.

See Also:
Core - Introduce an automatic check to the deleting algorithm whether an object is referenced by any other object
Deferred deletion and (foreign key) exception handling

SchedulerControl - Use the CustomDrawAppointment & CustomDrawAppointmentBackground events

How to use WorkspaceManager for capturing, applying, saving and loading workspaces

$
0
0

This example demonstrates how to use standalone Workspace Manager API for capturing, applying, saving and loading workspaces and shows different Transition Types in action. 
You can find the general information about the WorkspaceManager in our documentation: Workspace Manager

Note that the Workspace Manager provides a bar menu, represented by the BarWorkspaceMenuItem class to assist both you and your end-users in creating, saving and loading workspaces. This item can be added to the required Bar or RibbonControl.

How to display a readonly HTML formatted text in Grid cells

$
0
0

This example illustrates how to create a custom editor to display a readonly HTML formatted text. In standalone mode you can use the LabelControl instead.

To show the HTML formatted text in a grid you can assign the RepositoryItemRichTextEdit to an appropriate column. However, the RichEditControl is quite a complex and "heavy" control. So, if you only need to show the HTML formatted text in the grid without editing it the best way to get it done is to assign a custom RepositoryItemHtmlLabel to a column. Note that the HtmlLabelViewInfo implements the IHeightAdaptable interface. So, this custom control supports the word wrapping feature and grid's row auto height feature will work properly.

Question Comments

Added By: Anders Wang at: 9/26/2015 1:06:06 AM    

Hi
How to make the text in the cell can be selected? Thanks.

Added By: Andrew Ser (DevExpress Support) at: 9/28/2015 12:39:31 AM    Hello Anders,
I've extracted your inquiry into a separate thread - How to display selectable HTML text in grid cells. Let's discuss this question there.Added By: Valeria Avramova at: 4/11/2018 6:16:55 AM    I cannot use the LabelControl for this. The documentation says the Label control works for href but not any other text. The comment above saying it supports ReadOnly HTML is misleading.Added By: Svetlana (DevExpress Support) at: 4/11/2018 1:43:34 PM    

Hi, 

Our LabelControl supports simple HTML tags as described in the HTML Text Formatting help article. We also have a special HyperlinkLabelControl as your aim is to show text or a portion as a hyperlink. 

GridView - How to use GridLookup with single selection mode in EditForm

$
0
0

This example illustrates how to use GridLookup with single selection mode (SelectionMode is Single) in GridView for CRUD operations. By default, GridView doesn't have a built-in column for this scenario. The main idea is to use the MVCxGridViewColumn.SetEditItemTemplateContent method to place GridLookup in EditForm. The same approach will work for a custom EditForm (GridViewSettings.SetEditFormTemplateContent) as well.

In order to use client-side unobtrusive JavaScript validation with GridLookup, it's necessary to pass a correct model instance to a partial view. This instance should be of the same type as an item of the collection bound to GridView.

Controller:

[C#]
publicActionResultGridLookupPartial(int?KeyParameter){varmodel=GetModelInstanceByKey(KeyParameter);returnPartialView(model);}

 

[VB.NET]
PublicFunction GridLookupPartial(ByVal KeyParameter?AsInteger) As ActionResultDim model = GetModelInstanceByKey(KeyParameter)Return PartialView(model)EndFunction


 PartialView:

[C#]
@Html.DevExpress().GridLookup(settings=>{settings.Name=PropertyName;}).BindList(...).Bind(Model.PropertyName).GetHtml()
[VB.NET]
@Html.DevExpress().GridLookup(Sub(settings) settings.Name = PropertyNameEndSub).BindList(...).Bind(Model.PropertyName).GetHtml()


See also: 
GridView - How to use GridLookup in EditForm in multiple selection mode

Web Forms:
How to use two-way data-bound ASPxGridLookup in edit form of ASPxGridView to edit data
How to use ASPxGridLookup in multiple selection mode as the ASPxGridView editor

Question Comments

Added By: James Mayer at: 10/25/2018 11:46:51 AM    WEB FORM LINKS GO TO MVC EXAMPLES :)

How to implement the ItemsSource property for the LayoutGroup/LayoutControl control

$
0
0

LayoutGroup/LayoutControl doesn't have the built-in ItemsSource property. In this example, we demonstrated how to provide this functionality using a custom behavior class. This behavior generates LayoutItem controls when the associated collection is changed and adds them to the Children collection of the associated control.

Question Comments

Added By: Andrew Cope 2 at: 1/2/2018 3:46:31 AM    I had to override the OnAttached() event:
[C#]
protectedoverridevoidOnAttached(){base.OnAttached();ArrangeChildren();}
And you also need a guard on ArrangeChildren():
[C#]
{if(AssociatedObject==null)return;

Without this ArrangeChildren() was only called once and it was before AssociatedObject had been set.

Although so far it hasn't actually solved my problem anyway - the controls haven't lined up :-/ Added By: Ivan (DevExpress Support) at: 1/3/2018 1:32:12 AM    

Hi Andrew,
Your approaches are absolutely correct. I have updated this example to apply them and slightly changed the implementation to make it possible to attach our custom behavior to individual groups. It is now unnecessary to obtain groups by their names, and you also can populate multiple groups within your LayoutControl dynamically.
As for the last issue, please check if it exists in the updated example and let me know your results.

Added By: Andrew Cope 2 at: 1/24/2018 6:43:38 AM    Unfortunately there's another bug here :)

RearrangeChildren() is too indiscriminate when it responds to a .Reset event - it clears down everything as well as any items you have added. In my case I ended up with an almost empty view :) I modified my version to only remove FrameworkElements where the DataContext was set appropriately. In my case the DataContext is of type ButtonDescriptor:
[C#]
if(e.Action==NotifyCollectionChangedAction.Reset){varunwantedItems=newList<FrameworkElement>();foreach(varchildinAssociatedObject.Children){if(childisFrameworkElementelement){if(element.DataContextisButtonDescriptor)unwantedItems.Add(element);}}foreach(varunwantedIteminunwantedItems){AssociatedObject.Children.Remove(unwantedItem);}}

Added By: Andrew Cope 2 at: 1/24/2018 6:58:07 AM    Oh, and yes, my other problem was resolved. It was another problem entirely :)Added By: Ivan (DevExpress Support) at: 1/25/2018 4:59:51 AM    Indeed, this approach is too aggressive and assumes that all items are generated from the ItemsSource collection. Thank you for sharing your final solution with us :)Added By: Bob Sleys at: 3/6/2018 8:46:01 AM    I am attempting to make use of this but am having trouble in the items in the groups aren't arranged properly.  I'm getting all the items added and can even adjust them via databound properties, ie Horizontal/Vertical, input type by datatemplates etc.  I just can't get the alignment and sizing to work correctly.

Screen Shot

Notice in the above screen shot the labels aren't uniform in size in a group resulting in the inputs being jagged.

My XAML is:
[XAML]
<UserControlx:Class="ES_Desktop.Views.Policy.Forms.FormView"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol"xmlns:conv="clr-namespace:ES_Inf.WPF.Converters;assembly=ES-Inf"xmlns:helper="clr-namespace:ES_Inf.WPF.Helpers;assembly=ES-Inf"xmlns:vm="clr-namespace:ES_Desktop.ViewModels.Policy.Forms"xmlns:local="clr-namespace:ES_Desktop.Views.Policy.Forms"xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"mc:Ignorable="d"d:DesignHeight="800"d:DesignWidth="600"d:DataContext="{dxmvvm:ViewModelSource Type={x:Type vm:FormViewModel}}"><UserControl.Resources><ResourceDictionary><ResourceDictionary.MergedDictionaries><ResourceDictionarySource="/ES-Desktop;component/Themes/ControlStyles.xaml"/></ResourceDictionary.MergedDictionaries><DataTemplateDataType="{x:Type TypeName=vm:CardViewModel}"><dxlc:LayoutGroupHeader="{Binding Caption}"Orientation="{Binding Path=FormSection.Vertical, Converter={conv:VertBoolToOrientation}}"ScrollBars="Auto"HorizontalAlignment="Left"VerticalAlignment="Top"View="GroupBox"><dxmvvm:Interaction.Behaviors><helper:ItemsSourceHelperItemsSource="{Binding QuestionViewModels}"/></dxmvvm:Interaction.Behaviors><dxlc:LayoutGroup.GroupBoxStyle><StyleTargetType="dxlc:GroupBox"><Style.Triggers><DataTriggerBinding="{Binding FormSection.HideTitle}"Value="true"><SetterProperty="TitleVisibility"Value="Collapsed"/><SetterProperty="Padding"Value="0"/></DataTrigger></Style.Triggers></Style></dxlc:LayoutGroup.GroupBoxStyle></dxlc:LayoutGroup></DataTemplate><DataTemplateDataType="{x:Type TypeName=vm:TableViewModel}"><local:TableView/></DataTemplate><StyleTargetType="dxlc:LayoutItem"><SetterProperty="LabelPosition"Value="{Binding LabelPosition}"/><SetterProperty="AddColonToLabel"Value="True"/><SetterProperty="Visibility"Value="{Binding HideInput, Converter={StaticResource InverseBooleanToVisibilityConverter}}"/><SetterProperty="LabelTemplate"><Setter.Value><DataTemplate><TextBlockText="{Binding}"/></DataTemplate></Setter.Value></Setter><Style.Triggers><DataTriggerBinding="{Binding HideLabel}"Value="False"><SetterProperty="Label"Value="{Binding FormQuestion.ScreenLabel}"/></DataTrigger></Style.Triggers></Style><DataTemplateDataType="{x:Type TypeName=vm:StringQuestionViewModel}"><dxe:TextEditWidth="{Binding ScreenWidth}"EditValue="{Binding Var.Value}"IsReadOnly="{Binding FormQuestion.ReadOnly}"/></DataTemplate><DataTemplateDataType="{x:Type TypeName=vm:CurrencyQuestionViewModel}"><dxe:SpinEditDisplayFormatString="{Binding FormQuestion.FormatString}"Increment="{Binding Increment}"EditValue="{Binding Var.Value}"Width="{Binding ScreenWidth}"IsReadOnly="{Binding FormQuestion.ReadOnly}"/></DataTemplate><DataTemplateDataType="{x:Type TypeName=vm:BooleanQuestionViewModel}"><dxe:CheckEditVerticalAlignment="Center"HorizontalAlignment="Left"EditValue="{Binding Var.Value}"IsReadOnly="{Binding FormQuestion.ReadOnly}"/></DataTemplate><DataTemplateDataType="{x:Type TypeName=vm:CalculatedQuestionViewModel}"/><DataTemplateDataType="{x:Type TypeName=vm:DateQuestionViewModel}"><dxe:DateEditWidth="{Binding ScreenWidth}"EditValue="{Binding Var.Value}"IsReadOnly="{Binding FormQuestion.ReadOnly}"/></DataTemplate><DataTemplateDataType="{x:Type TypeName=vm:IntegerQuestionViewModel}"><dxe:TextEditWidth="{Binding ScreenWidth}"MaskType="Numeric"Mask="n0"EditValue="{Binding Var.Value}"IsReadOnly="{Binding FormQuestion.ReadOnly}"/></DataTemplate><DataTemplateDataType="{x:Type TypeName=vm:PhoneQuestionViewModel}"><dxe:TextEditVerticalAlignment="Center"HorizontalAlignment="Left"Margin="5"Width="{Binding ScreenWidth}"MaskType="Regular"Mask="(\d?\d?\d?) \d\d\d-\d\d\d\d"EditValue="{Binding Var.Value}"IsReadOnly="{Binding FormQuestion.ReadOnly}"Visibility="{Binding HideInput, Converter={StaticResource InverseBooleanToVisibilityConverter}}"/></DataTemplate><DataTemplateDataType="{x:Type TypeName=vm:DropDownQuestionViewModel}"><local:DropdownQuestionView/></DataTemplate><DataTemplateDataType="{x:Type TypeName=vm:ItemSelectQuestionViewModel}"><local:ItemSelectQuestionView/></DataTemplate></ResourceDictionary></UserControl.Resources><Grid><dxlc:LayoutControlOrientation="Vertical"ScrollBars="Auto"><dxlc:LayoutGroupView="Group"Orientation="Vertical"><dxmvvm:Interaction.Behaviors><helper:ItemsSourceHelperItemsSource="{Binding FormSections}"/></dxmvvm:Interaction.Behaviors></dxlc:LayoutGroup></dxlc:LayoutControl></Grid></UserControl>

Added By: Andrey Marten (DevExpress Support) at: 3/6/2018 10:00:25 AM    


Hello Bob,

To process your question in the most efficient way, I've extracted it to a separate thread:T613014: Groups are not arranged correctly when the approach from E5081 is used). It has been placed in our processing queue and will be answered shortly.

Thanks,
Andrey

Added By: Andrew Cope 2 at: 10/26/2018 4:33:53 AM    If anyone wants the ability to use this class to save/restore layouts there's a modified version of the LayoutControlHelper class here:

https://www.devexpress.com/Support/Center/Question/Details/T682098/save-restore-layout-behaving-oddly

OBSOLETE - How to create a PropertyEditor based on the XtraRichEdit control

$
0
0

UPDATE: Use the Office Module to integrate DevExpress WinForms Rich Text Editor in all new XAF WinForms applications. The current example is obsolete.


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

Important Notes
1.
 Please take special note that this example is not a complete solution and is supposed to be further tested and modified by you according to your business requirements.

2. The standard XAF Save Action may be activated on the first load in this example, because the MS Word and XtraRichEdit RTF formats are different and thus the object receives a different value on the first value post. Once you save the value in the control's format, it will work as expected. See also the Problem with setting the RtfText in XtraRichEdit and ImmediatePostData with XtraRichEdit tickets for the details on how to improve tracking of changed values in the RichEditControl component.

 

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

Question Comments

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

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

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

Added By: Jerome Pech at: 5/16/2016 12:15:32 PM    Merging the Ribbon does not work if UseOldTemplated = false; is set. 
[C#]
return((XtraFormTemplateBase)(Application.MainWindow.Template)).Ribbon;
causes an error, that DetailFormRibbonV2 can not be converted to XtraFormTemplateBase.

Can you please provide an example how to merge ribbons with the new Ribbon V2 (using 15.2)?











Added By: Dennis (DevExpress Support) at: 5/17/2016 2:49:05 AM    

@Jerome: Thanks for your input. Our team will take it into account. Even though we do not currently have free resources to provide a different example, you can refer to the eXpressApp Framework > Task-Based Help > How to: Access the Ribbon Control article to learn more on how to access the ribbon component and implement this merging yourself (by analogy with what was shown in the original example). Should you experience any difficulties, do not hesitate to submit a separate ticket to discuss your implementation (https://www.devexpress.com/Support/Center/Question/Create).

Added By: Jerome Pech at: 5/17/2016 3:43:53 AM    @Dennis

The link "How to: Access the Ribbon Control" helped me to accomplish my task!

Tanks a lot!

Kind regards Added By: Dennis (DevExpress Support) at: 5/17/2016 4:11:12 AM    @Jerome: Anytime! Feel free to share your Controller here for other XAF users.Added By: Jerome Pech at: 5/17/2016 4:33:04 AM    Sure!

Simply replace
[C#]
if(Application.MainWindow!=null&&Application.MainWindow.Template!=null){return((XtraFormTemplateBase)(Application.MainWindow.Template)).Ribbon;}

with
[C#]
if(Application.MainWindow!=null&&Application.MainWindow.Template!=null&&Frame.TemplateisDetailRibbonFormV2){return((DetailRibbonFormV2)(Frame.Template)).Ribbon;}

Added By: Andrey K (DevExpress Support) at: 3/27/2018 1:40:57 PM    

Hello,

We are going to provide Rich Text Editor integration in an upcoming release, so this example will be obsoleted. Please refer to the T608185: WinForms Rich Text Editor Module - v18.1 Preview article to see implementation details and provide us with your opinion regarding it.
If you have already seen this article, please refer to it again and answer our Q6 question (we added it recently). 

Thanks,
Andrey


How to implement the multi-row editing feature in the ASPxGridView

$
0
0

UPDATED:

Starting with version 13.2, the ASPxGridView control offers the basic "Batch Editing Mode" functionality that allows accomplishing a similar task with less effort and does not require so much extra code. See the ASP.NET WebForms & MVC: GridView Batch Edit blog post to learn more about this new functionality.

Starting with version 14.1, the ASPxGridView control offers advanced "Batch Editing Mode" programming options.

You can find a standalone DB-independent solution in our Code Examples base at:
ASPxGridView - A simple Batch Editing implementation

If you have version v14.1+ available, consider using the built-in functionality instead of the approach detailed below.
If you need further assistance with this functionality, please create a new ticket in our Support Center.

To implement this, I added the ASPxTextBox to the DataItemTemplate Container of several columns and bound these editors to the underlying data source. This will force the ASPxGridView to always display editors in these columns. So, the end-user can input values in these editors. After that click the PostModifications button to preserve the changes made. NOTE, this is done without switching the ASPxGridView to the EditMode and back.

To preserve the changes made, I saved editor values to the List<object> and then used these values by setting the UpdateParameters of the ASPxGridView's DataSource. Finally, to obtain editors and their values, I used the ASPxGridView.FindRowCellTemplateControl Method.

See Also:
How to implement the multi-edit functionality with a multi-page grid that is bound dynamically
Custom client-side logic implementation in the grid with multi-row editing
How to edit multiple selected rows in a single Edit Form
How to force the grid to stay in Edit mode
How to perform ASPxGridView instant updating using different editors in the DataItem template

Question:E324 - How to calculate the ASPxGridView group summaries on the client side


MVC:
How to implement the multi-row editing feature in the ASPxGridView

Question Comments

Added By: jdubeau at: 7/17/2012 5:50:48 PM    

this example does update anything.

Added By: Wendy Ramsaur at: 7/23/2012 12:57:07 PM    

How are you collecting updated information and putting it in to the list? This only updates with the original information.

Added By: yaniv abo at: 7/25/2012 11:16:17 AM    

whan you select Run Online the Grid data does not update whan you click "Post Modifications"

Added By: Manish Singh 8 at: 7/30/2012 11:43:03 PM    

@yaniv abo : you have to provide the KeyFieldName Properties of gridview then this code will work

Added By: Wendy Ramsaur at: 7/31/2012 10:34:47 AM    

OK, it works...sort of. I have a column represented by a RadioButtonList. The callback is not getting any updated values. Can I get some help?

Added By: Wendy Ramsaur at: 7/31/2012 10:45:12 AM    

Also just tried using a textbox. Again, does not get updated values in this example.

Added By: Fiona Titcombe at: 10/18/2012 4:00:21 AM    

Is there any solution to this? FindRowCellTemplateControl(grid, col, "txtBox") returns the original value, not the updated value.

Added By: Hamdy Nassar at: 10/20/2012 12:44:48 AM    

thanks alot it is working perfect

Added By: Steve Knowles at: 12/10/2012 10:16:11 AM    

I am having the same problem as others in that the original, not updated value is being returned. Has anyone figured out why this happens in some projects?

Added By: Ashley Perkins at: 12/18/2012 9:02:33 AM    

To anyone having problems with this demo make sure you are not touching the grid view data source on page load.

I was changing the select query and rebinding on page load, this caused the values to reset. Got rid of that and it worked perfectly.

Added By: Bryan Meier at: 1/31/2013 11:36:43 AM    

To add on to what Ashley commented on...

Make sure you have the AutoPostBack set to false on the button you are using to perform the callback. By default the value is true which will override your callback and the OnCustomCallback event of your grid will never get called. Not to mention your changes will be reverted back to the original values.

Added By: Prashanthi G at: 9/3/2013 9:19:25 PM    

In this given example no.of rows is less and it is working fine, how to achieve this kind of functionality if more no of records more say for ex 100 records. page load became very slow and some times not responding message is coming. Any suggessions

Added By: Philippe Foucart at: 9/24/2013 2:18:37 AM    

Works perfect for me on pc, but not on ipad -> on ipad, when clicking the button, nothing happens, I just get the circling image indicating somethings happening in background, but looks like callback is not executed.
any ideas?

Added By: Richard Wilke at: 11/10/2013 3:10:37 PM    

I have converted this code to fit my database structure. It looks like everything is coded correctly, but after running through the code to update the database ...

 for (int i = 0; i < list.Count; i++) {
                AccessDataSource1.UpdateParameters["CategoryName"].DefaultValue = list[i].CategoryName;
                AccessDataSource1.UpdateParameters["Description"].DefaultValue = list[i].Description;
                AccessDataSource1.UpdateParameters["CategoryID"].DefaultValue = list[i].Id.ToString();
// AccessDataSource1.Update(); << Uncomment this line to update data!
            }
            ASPxGridView1.DataBind();

The database never gets updated. Any thoughts? The list gets built correctly and contains all the updated data from the grid. Help.

Added By: M Abo Habiba at: 1/6/2014 1:55:28 AM    

Is this resolved 13.2 as BatchEdit ?

Added By: Paul Astro at: 8/13/2014 12:48:28 PM    

Can we use this Example somehow but within using it within a FORM<>  ???

Added By: Artem (DevExpress Support) at: 8/13/2014 11:17:10 PM    

Hello Paul,

To process your recent post more efficiently, I created a separate ticket on your behalf: T140120: E324 - Using within a form. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

OBSOLETE - How to speed up WinForms apps, running in a Remote Desktop Services environment

$
0
0

To achieve this goal, you can disable visual styles, skins, animations, and set various controls options. Note that here we additionally disable visual effects of two most "expensive" controls: RibbonControl and BarManager, which provide bars, docking functionality, context menus, alert windows and a Ribbon interface for your .NET WinForms applications. The attached example shows how to do this by an example of an XAF Windows Forms application. If you do not use XAF, then you can obtain the necessary code from this example, and put it in the entry point of your application (usually it's the Main method).

IMPORTANT NOTE
1. You can greatly reduce memory consumption if you use the BarManager instead of RibbonControl on your forms. For example, an XAF Windows Forms application with BarManager consumes half as much memory than the same application using the RibbonControl. In XAF you can switch between the standard bars and ribbon menu using the FormStyle property of the Options node in the Model Editor.
2. To avoid painting problems when using the RibbonForm and RibbonControl on Vista or Windows 7 with the Aero theme enabled, don't set the System.Windows.Forms.Application.VisualStyleState property to VisualStyleState.NoneEnabled. Alternatively, you can set the RibbonForm.AllowFormGlass property to false. This is because we use the VisualStyleRenderer to draw text on transparent headers.

See Also:
Add a new static property to the XtraAnimator class which will allow a developer to disable animation in all DevExpress controls
Performance Tuning CPU Use for 16 and 32-bit Windows Applications
Build Your Skills: How to optimize apps to run in Terminal Services
Tuning applications for the Terminal Services
Performance Tuning Guidelines for Windows Server 2008

Question Comments

Added By: Carlitos at: 3/9/2015 10:19:37 PM    

I am trying this code in my windows client but can't get it to work. In the ResolveTemplate method the formTemplate is always null because the IFrameTemplate template is DevExpress.ExpressApp.Win.Templates.Bars.MainFormV2

Added By: Dennis (DevExpress Support) at: 3/10/2015 5:49:28 AM    

@Carlos: Starting with v14.2, new templates for the main and detail forms are used in XAF. So, you should check for the RibbonForm type instead of the XtraFormTemplateBase one from within the ResolveTemplate method when customizing the ribbon template. I have attached the updated code below. We'll consider updating this example accordingly in the future.


[C#]
usingDevExpress.ExpressApp;usingDevExpress.ExpressApp.Templates;usingDevExpress.ExpressApp.Win.Controls;usingDevExpress.LookAndFeel;usingDevExpress.Skins;usingDevExpress.XtraBars;usingDevExpress.XtraBars.Controls;usingDevExpress.XtraBars.Ribbon;namespaceDisableVisualStylesModule.Win{publicclassDisableVisualStylesWindowController:WindowController{publicDisableVisualStylesWindowController(){TargetWindowType=WindowType.Main;}protectedoverridevoidOnActivated(){base.OnActivated();DisableVisualStyles();}protectedoverridevoidOnDeactivated(){base.OnDeactivated();Application.CustomizeTemplate-=Application_CustomizeTemplate;}privatevoidApplication_CustomizeTemplate(objectsender,CustomizeTemplateEventArgse){ResolveTemplate(e.Template);}protectedvirtualvoidDisableVisualStyles(){if(System.Windows.Forms.SystemInformation.TerminalServerSession){Application.CustomizeTemplate+=Application_CustomizeTemplate;InitGlobalOptions();}}protectedvirtualvoidInitGlobalOptions(){Animator.AllowFadeAnimation=false;SkinManager.DisableFormSkins();SkinManager.DisableMdiFormSkins();BarAndDockingController.Default.PropertiesBar.MenuAnimationType=AnimationType.None;BarAndDockingController.Default.PropertiesBar.SubmenuHasShadow=false;BarAndDockingController.Default.PropertiesBar.AllowLinkLighting=false;System.Windows.Forms.Application.VisualStyleState=System.Windows.Forms.VisualStyles.VisualStyleState.NoneEnabled;}privatevoidResolveTemplate(IFrameTemplatetemplate){IBarManagerHolderformTemplate=templateasIBarManagerHolder;if(formTemplateisRibbonForm){InitRibbonOptions(((RibbonBarManager)formTemplate.BarManager).Ribbon);}else{InitBarOptions(formTemplate.BarManager);UserLookAndFeel.Default.SetWindowsXPStyle();}}protectedvirtualvoidInitRibbonOptions(RibbonControlribbon){if(ribbon!=null){ribbon.ItemAnimationLength= 0;ribbon.GroupAnimationLength= 0;ribbon.PageAnimationLength= 0;ribbon.ApplicationButtonAnimationLength= 0;ribbon.GalleryAnimationLength= 0;ribbon.TransparentEditors=false;InitBarOptions(ribbon.Manager);}}protectedvirtualvoidInitBarOptions(BarManagermanager){if(manager!=null){manager.AllowItemAnimatedHighlighting=false;}}}}
Added By: Carlitos at: 3/10/2015 11:22:35 AM    

Thank you Dennis! Works like a charm!!!

Added By: Arjan van Dijk at: 7/14/2015 2:40:57 PM    

You can also consider ngen.exe to speed up

Added By: Paul Berger at: 9/15/2015 10:02:14 PM    

Is there an article like this for VCL?

Added By: Dennis (DevExpress Support) at: 9/16/2015 1:06:48 AM    

@Paul: To process your recent post more efficiently, I created a separate ticket on your behalf: T290221: How to speed up application under Remote Desktop Services (formerly known as Terminal Services) environment. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: manraj patel 2 at: 9/21/2015 5:19:02 AM    

What if I am not using ExpressApp framework in my app?

Added By: Dennis (DevExpress Support) at: 9/21/2015 5:22:03 AM    @manraj: You can just set the RibbonControl, SkinManager, etc. properties manually as shown in the code example above.Added By: Christoph Mark at: 2/6/2018 12:01:12 AM    Using ngen to speed up is really effective!
But you have to take care about your platform:

Ngen can be runned for 32-Bit or for 64-Bit.
32-Bit: C:\Windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe
64-Bit: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe

If your app is running in x64 (or "Any CPU" on 64-Bit-Machine) you need to use ngen-Framework64.

We prefer 32-Bit, because we don't need "benefits" of 64-Bit and 32-Bit runs faster in our environments.
Added By: MrAvgProgrammer at: 10/31/2018 1:03:18 PM    Is there an Current Update to this topic? 

I am looking to "optimize" my Windows Form app for Remote Desktop and we have many forms as RibbonForms. 

What properties can I disable that will help improve performance?

Added By: Dennis (DevExpress Support) at: 10/31/2018 1:49:20 PM    

@MrAvgProgrammer:
We plan to deprecate this article. Instead, please post to the most recent WinForms Tips & Tricks - Boosting Application Performance. I hope this helps.

Multiple selection using checkbox (web style)

$
0
0

Important note.

Starting with version 13.2, GridView provides a built-in checkbox column for multiple row selection. So, to enable this type of multiple row selection in newer versions, it is sufficient to enable the GridViewOptionsSelection.MultiSelect option and then set the GridView.OptionsSelection.MultiSelectMode property to the GridMultiSelectMode.CheckBoxRowSelect value. Take a look at the How to use an unbound check box column to select grid rows example for sample code.


This example demonstrates how to add a check column to allow web-style multiple row selection. End-users can select/deselect rows, group rows or select/deselect all rows by clicking the column header. Changing a check box value does not initiate row editing. 



All code related to selection resides in the GridCheckMarksSelection helper class. So, to implement this functionality in your application, you can simply add this class to your project and then create a new GridCheckMarksSelection instance.
Please note if you use the AppearanceEvenRow and AppearanceOddRow styles, by default they have a higher priority than the RowStyle event used for the selection in this example. To avoid drawing incorrect selected rows, enable the e.HighPriority option. 

The GridCheckMarksSelection class also provides different ~Select methods which allow selecting data and group rows in code. To obtain selected rows, you can use the SelectedCount property and GetSelectedRow method.

Question Comments

Added By: Marc Roussel at: 10/11/2012 5:59:00 AM    

Hmmm how do I use this class ?

Added By: You Logic at: 10/16/2012 4:16:54 AM    

When I select a row via code, the check box is not checked. How can I do this!?

Added By: Piotr Christ at: 2/8/2013 4:13:11 AM    

I had the same problem as You Logic ! How select row (with checkbox) from code ?

Added By: (no info) at: 11/25/2013 2:23:24 PM    

While this is a very nice implementation there is a problem with the code. Because you have defined selection *in the CheckMarkSelection.cs" as an ArrayList it is next to impossible to get at any values contained within each of the actual selected rows from the grid. Let's say one needs to obtain two of the values within the row...one is a string and one is an integer...how do you get the values out? There are no extension methods associated with "selection" that would allow you to enumerate the data lets say using linq or even simply doing somethin like: DataRowView theRow = (DataRowView)this.selection.GetSelectedRow(i); What happens is there is a cast error that occurs due to the generic types within the ArrayList. Granted this is necessary as we have an unknown group of column objects and values. There needs to be a built in method to access the individual values in the selected rows from "selection". I have tried 12 different methods to extract them and still a Cast error occurs.

Added By: Dave Smith 6 at: 3/4/2016 2:15:24 AM    After implementing this class the column does not show, not sure what I'm doing wrong.

In the constructor of my form  I call  new GridCheckMarksSelection(gridViewSearchInventory);

and then in the form load i bind to my grid Added By: Sasha (DevExpress Support) at: 3/4/2016 6:20:43 AM    

Hello Dave,
I've created a separate ticket on your behalf: GridControl - The check box column is not shown when using a class from the E1271: Multiple selection using checkbox (web style) example .
We will update it shortly.

Added By: Jacobo Amselem at: 4/14/2016 3:35:49 AM    Hello
How can I modify View_Click() to invert group row selection when clicking the group checkbox ONLY?
Current implementation inverts selection when clicking anywhere in the group row.

Thank you Added By: Alisher (DevExpress Support) at: 4/14/2016 5:05:29 AM    

Hello,

I've created a separate ticket on your behalf (T367815: How to invert group row selection when clicking the group checkbox only?). It has been placed in our processing queue and will be answered shortly.

Added By: Jacobo Amselem at: 4/22/2016 5:08:26 AM    Hello again,
How could I modify this sample so the check column is the very first column when AlignGroup SummaryInGroupRow = True?

I think this is related, but it's still confusing for me: https://www.devexpress.com/support/center/Question/Details/T365937#comment-e1c23ee5-92fd-4fd3-a2e3-b487a566d095

Thank you Added By: Alisher (DevExpress Support) at: 4/25/2016 5:18:54 AM    

Hi Jacobo,

The AlignGroupSummaryInGroupRow option is available starting with version 15.2 of our components. Therefore I think that you are using the latest version of our products in your project. However, the functionality implemented in this example can be used out of the box in the mentioned version. Set the GridView's OptionsSelection.MultiSelect property to True and the OptionsSelection.MultiSelectMode property to CheckBoxRowSelect to enable it.
Would you please clarify why you are still using this example to achieve this functionality?

As for the issue with incorrect painting of column headers, we are aware of it and have already fixed it. Please take a look at the The Grid doesn't paint correctly either the column header or the cell value if AlignGroupSummaryInGroupRow is set ticket for more information.

Added By: Jacobo Amselem at: 4/25/2016 5:42:49 AM    Hi Alisher
Yes I'm in the latest version of your components, and I'm aware of the CheckboxRowSelect option.
However my original issue is the one described in : https://www.devexpress.com/Support/Center/Question/Details/T294110
(selection checkboxes are cleared when the grid is filtered).  The solution to that issue sug gests to use the sample shown in this page to achieve checkbox column+filtering persistence so here I am.

My issue now is that when enabling AlignGroupSummaryInGroupRow the checkbox is shown after the grouped columns and I'd like to show it before. I did read the issue: https://www.devexpress.com/support/center/Question/Details/T365937
but it still unclear to me how can I proceed.  Can you give some guidance?
thank you


Added By: Alisher (DevExpress Support) at: 4/26/2016 5:40:29 AM    

Hi Jacobo,

Thank you for the clarification.

At present setting the AlignGroupSummaryInGroupRow property forces the Grid to display fixed columns after grouped columns. I don't see an easy way to overcome this behavior. I have created a separate ticket (GridControl - Setting the AlignGroupSummaryInGroupRow forces the Grid to display fixed columns after grouped columns) and passed it to our developers. We will examine the possibility of placing fixed columns before grouped columns. Please add that ticket to your Favorites to be notified of our progress.

Added By: Bassam Shahtoot 1 at: 11/1/2018 6:00:23 AM    how can add right to left support ? 
when the form set on right to left , the checkbox not appears on group row 

How to search for objects by using all the properties or by using more complex criteria

$
0
0

This example provides a possible workaround for the Filtering - Support searching objects by a string through all the properties (or a set of properties) or by more complex criteria suggestion.
The Dennis.Search.Win module, shown in the example, provides API to create a non-persistent object that can be used to search by properties of a business class. Such a non-persistent search-object should implement the ISearchObject contract. By default, it's supported by the abstract and generic SearchObjectBase class in the module. Search-objects are shown in a Detail View with the help of the SearchObjectViewController. To compose a search criteria, a specific SearchObjectPropertyEditor is used (it contains the Search and Clear buttons).
An example use of the implemented module is illustrated in the WinSolution.Module.Win module. There is a ProductSearchObject class that is inherited from the base SearchObjectBase class. If necessary, you can create several search objects for one business class. In UI, all search objects will be listed in a drop-down list in the toolbar of a View of your business class. Download and run the attached example to see how this works in action.
(Take special note of the SearchObjectBase class implementation, because it asynchronously loads search results of a specific type from the data store into the Search Results nested List View.)

Note that if you are implementing this functionality in ASP.NET, it is necessary to set the WebApplication.CollectionsEditMode property to Edit. Otherwise, the search results will not be displayed.

 

See Also:
How to allow users to create filter via the criteria editor before previewing a report
How to use Criteria Property Editors

Question Comments

Added By: Taradanov at: 6/17/2012 8:28:29 AM    

Can you provide Web editor for this example, please?

Added By: Gavin Lipeng Ma at: 3/20/2013 7:50:39 PM    

Also need a web solution.Could you please provide a web solution for this ?

Added By: kenngo at: 5/30/2014 10:49:42 PM    

The SearchObjectBase[Product]_SearchResults_ListView in the Model Editor is autogenerated? How is the search result link to this view?

Added By: Dennis (DevExpress Support) at: 6/2/2014 2:34:35 AM    @kenngo: Yes, it is auto-generated by XAF. This is a nested ListView node, which corresponds to the SearchResults collection property of the SearchObjectBase class, which is used to display results in the UI.Added By: PTLab at: 1/29/2015 11:04:01 PM    

Do you have a plan to upgrade example to 14.2? Or can you explain how I can do it myself?
Thank you.

Added By: Dennis (DevExpress Support) at: 1/30/2015 12:21:04 PM    

@PTLab: Yes, we plan to upgrade it and provide the Web version, although I cannot promise any time frame. For now, I suggest you follow the upgrade instructions General Information > Installation > Upgrade Notes

Added By: Centurio at: 11/3/2018 12:10:22 AM    Very interesting, how can I filter for a range of dates (from ... to)? 

How to use reporting controls in ASP.NET Core applications

$
0
0

This example demonstrates how to use the End-User Report Designer and HTML5 Document Viewer in an ASP.NET Core application targeting .NET Framework v 4.6.1.

These controls require the DevExpress.AspNetCore.Reporting NuGet and xtrareportsjs Bower packages. To integrate these controls into an application, register the required services in the Startup class, reference the necessary client resources and use the ReportDesigner or WebDocumentViewer wrapper.

This example uses an Entity Framework data source as well as an SQL data source.

Before running this example, do the following:
1. In Visual Studio, right-click the ASP.NET Core application and select Manage Bower Packages. In the invoked window, switch to the Updates page and update the xtrareportsjs package to the required version. This downloads all the required client resources for deploying the control.

2. Right-click the ASP.NET Core application and select Manage NuGet Packages. In the invoked window, switch to the Updates page, enable the Include prerelease check box and update the DevExpress.AspNetCore.Reporting package. 
You may need to add a new NuGet package source to install DevExpress packages online or offline from the C:\Program Files (x86)\DevExpress 17.2\Components\System\Components\packages path.

For step-by-step instructions, refer to the following documentation topic: ASP.NET Core Reporting (.NET Framework).

Question Comments

Added By: Sven Glöckner at: 11/5/2018 5:55:14 AM    Is there any way to install xtrareportsjs  by using npm or Visual Studio's new libman package manager?
As Bower is considered deprecated we already removed Bower and switched to npm.

Thanks
Sven 
Viewing all 7205 articles
Browse latest View live


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