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

ASPxGridView - Cell Merging

$
0
0

The example shows how to implement the cell merge feature for the ASPxGridView control.
You can use the helper class that will perform cell merging for the grouped grid as well.
Please keep in mind that functionality such as row selection, in-place editing and focused row may not work as expected which is understandable.

Question Comments

Added By: Seonkyeong Min at: 5/11/2015 2:23:37 PM    

Hello, This example is not working well.

First Line is complex.

other lines is works.

i wanna attach an image file.
but i cant upload the image because you guys doesn't have upload file function.

Added By: Larry (DevExpress Support) at: 5/12/2015 12:33:07 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T240441: ASPxGridView - Issue with a cell merging. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Jay Gamblin at: 5/29/2015 10:41:37 AM    

This does not appear to work with 14.2.5.  I get  'ASPxClientTableFixedColumnsHelper' is undefined

Added By: Anthony (DevExpress Support) at: 6/1/2015 4:28:57 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T249336: E970 - 'ASPxClientTableFixedColumnsHelper' is undefined. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Balmukund Shrivastav at: 7/13/2015 12:13:52 AM    

Thanks for the helper class. this functionality is working first time on the page load for ASPxGridView v12.1, but grid get distorted when we try to filter the records. Appreciate if you could provide some help.

Thank you,
Blamukund

Added By: Mike (DevExpress Support) at: 7/13/2015 12:18:28 AM    

Hello Blamukund,

To process your recent post more efficiently, I created a separate ticket on your behalf: T266070: E970 for version 12.1. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Ivo Michielsen 1 at: 9/22/2015 2:54:32 AM    

Unfortunately I get an error while trying to implement this class. I get the error 'The typename "Rendering" does not exist in the type "DevExpress.Web.ASPxGridView" '. The version used is 15.1.6

Added By: Larry (DevExpress Support) at: 9/22/2015 5:49:14 AM    Hello,

It seems that you have created a separate ticket for this issue. Let's continue discussing this issue in the ASPxGridView - Cell Merging thread.


Drag & Drop in TreeList and GridControl - How to show dragged rows as a cursor

$
0
0

This example shows how to customize drag&drop in Grid and TreeList controls, so that a dragged row is shown as a cursor. To do so, you need to override the corresponding DragDropManager class to pass RowData to DragElement instead of the row content and change its template to draw rows in the same way as they are drawn in Grid.

Question Comments

Added By: Mikhail Shubin at: 9/22/2015 12:00:11 PM    

Nice solution!

How to show custom popup context menu items only for certain fields

$
0
0

This is an extended version of the How to add a custom popup menu item example. It demonstrates how to hide certain context menu items using the client-side ASPxClientMenuBase.PopUp and ASPxClientMenuBase.CloseUp events. It is possible to use the ASPxPivotGrid.JSProperties dictionary to pass additional information for client side processing.

To get the ID of a target Field Value item use the pivotGrid.fieldMenuFieldID property.
If the Header menu is shown, you can get the ID using the pivotGrid.headerMenuFieldID property.



Question Comments

Added By: Ananda Krishna 1 at: 7/18/2012 2:22:15 AM    

How to implement same when we click the field name in the area, say, coulmn or data area?

Added By: John (DevExpress Support) at: 9/22/2015 11:26:55 PM    Hi Ananda,
I have created a separate ticket for your question: How to show custom popup context menu when we click the field name in the area, say, coulmn or data area. Let's continue the conversation there.

How to: Initialize Business Objects with Default Property Values in XPO

How to: Initialize Business Objects with Default Property Values in Entity Framework

How to use AntiForgeryToken with GridView CRUD operations

How to configure the SQL Data Access component in code to bind the GridControl to a database

How to edit the SqlDataSource connection and query at runtime via wizard by using the SqlDataSourceUIHelper class

$
0
0

This example demonstrates how to use the SqlDataSourceUIHelper class to give the End-User a capability to edit the SqlDataSource component's connection or queries at runtime via wizards.

To execute a connection configuration wizard, call the SqlDataSourceUIHelper.ConfigureConnection method and pass the SqlDataSource component instance to it.
To execute a query editing wizard, call the SqlDataSourceUIHelper.EditQuery method and pass the SqlDataSource component's SqlQuery instance to it. 
Note that it is necessary to refill the SqlDataSource after its connection or query was edited. Use the SqlDataSource.Fill method for this purpose.

Finally, I would like to mention that the SqlDataSourceUIHelper class also provides other wizards that can be used to configure the SqlDataSource component. Please refer to the SqlDataSourceUIHelper Members help topic for more information regarding this.



See also:
Binding to SQL Data
T291969: SqlDataSource - How to change connection parameters at runtime

How to implement conditional formatting for rows

$
0
0

The following sample demonstrates how to change the appearance of grid rows based on a  condition. For example, in this tutorial you can see that the background color of grid rows is gradually changed based on the value in the second data column.

This is done by binding the Background property of a style, assigned to a row, to a color converter. This converter is represented by the ColorValueConverter class that implements the IValueConverter interface and returns a color according to the provided numerical value.

Updated:

In v14.1, we implemented this functionality out-of-the-box. Please refer to the Conditional Formatting help topic for details.

Question Comments

Added By: Fahad at: 7/9/2013 3:50:45 AM    

Is there an easy way to Style each cell ? Or we have to use DataTemplate ?

Added By: Mary Roy at: 6/5/2014 1:46:45 PM    

Your sample does not work

Added By: Michael Ch (DevExpress Support) at: 6/6/2014 12:42:08 AM    Hello Mary,

Thank you for your remark. I have corrected this sample. Please review it.

Thanks,
Michael

Added By: ArunKallingal at: 9/17/2014 5:47:31 AM    

Can I get an example project for this?

Added By: Ivan (DevExpress Support) at: 9/17/2014 11:07:39 AM    

Sure. Here are good instruction on how to download examples - How to download a project attached to a Knowledge Base article. Follow the instructions starting from the "Download and install the "Example runner"..." point.

Report Storage for the End-User Report Designer (WPF beta)

$
0
0
The following example demonstrates how to implement a report storage to persist report definitions in a database or in any other custom location. This may be useful when providing end-users with the capability to create and customize reports using XtraReports End-User Designer if it is necessary to have a common target for saving and sharing all reports. At present, the aforementioned functionality is accomplished through the DevExpress.Xpf.Reports.UserDesigner.IReportFileStorage interface. The interface provides the following methods:
- ShowSaveAsDialog
- ShowOpenDialog
- Load
- Save
- GetErrorMessage
As we see, the interface methods are quite straightforward: the first two methods are intended to show a dialog to an end-user when selecting a report among the predefined reports, or otherwise, save it; when he does that, the Save or Load methods are invoked when the unique name of the selected report is invoked. That's where you should implement your custom save logic. If you're unfamiliar with this procedure, please refer to the original E2704 example, which provides additional information in this regard (the example illustrates the same technique but for WinForms EUD)
NOTE:
The WPF Report EUD is still in the beta stage (v.15.1); thus, there can be some limitations which are impossible to overcome at this moment (for example, there is no way to fill the SubReport's ReportSource drop-down window with the list of available reports). Moreover, some detail implementation may be changed on its official release. If you're experiencing any issues with running this sample or have additional questions, please contact our Support Team directly for further assistance.

How to modify the PopupContainerEdit reaction on the outer mouse click

$
0
0

By default, the RepositoryItemPopupContainerEdit.CloseOnOuterMouseClick property allows you to specify that the PopupContainerEdit should not close the pop-up window if the user clicks within another pop-up window opened by the control placed within the pop-up Form. However, there is no way to keep the pop-up window if the user clicks within the PopupContainerEdit owner Form. This example demonstrates how to create the editor inherited from the PopupContainerEdit that does not close its pop-up Form, unless the drop-down button or Escape keyboard key is pressed.

To implement this functionality, it is necessary to create a custom PopupContainerForm descendant, and override its AlllowMouseClick method. You can put any complex logic within this method to calculate whether or not the pop-up window should be closed in a certain situation. This example simply returns the True value in, any case.

See also:
How to register a custom editor for use in the XtraGrid

Question Comments

Added By: Martin Bauer 1 at: 9/7/2012 3:07:40 AM    

it doesnt help if the user does a click outside of the application. in this case the QueryResult comes to early. the bigest limitation is now you cant show modal dialogs(OpenFileDialog) from a custompopup. Sad!

Added By: Kevin Gabbert 1 at: 6/5/2015 4:38:57 PM    

CustomPopupContainerEdit does not implement ISupportInitialize, so this can't be used as a control on a form.  Nor can its popup position be set.  This makes this solution useless.

Added By: Uriah (DevExpress Support) at: 6/8/2015 12:37:52 AM    

Hello Kevin,

To process your recent post more efficiently, I created a separate ticket on your behalf: T252281: Feedback for E3586. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Nadezhda Voronina at: 7/24/2015 9:59:47 AM    

Hello.
I encountered the similar problem with my custom popup editor. When the user clicks outside the editor but inside the vertical grid owning this editor, it closes saving EditValue in the cell, as neccessary. But in the case of mouse click outside the grid my popup editor disappears leaving the cell value unchanged. I tried to call the grid's CloseEditor() method from various lost focus handlers, but it gave no result.
Please help me, how to force my popup editor to save changes in any case of closing up, except Esc pressed?

Added By: Andrew Ser (DevExpress Support) at: 7/27/2015 6:55:03 AM    Hello Nadezhda,
I've created a separate ticket - PopupContainerEdit (E3586) - Closes without saving a value when is used within VGridControl. Let's continue our discussion there.Added By: vasanthkumar rajasekhar at: 9/23/2015 8:23:00 AM    

is there a way in this example if i click outside to open an application form to not close.
in description says it closes only if clicking owner but its getting close when opening outside application also.

eg: user needs to open an excel and copy paste the values from excel to the form text boxes.

Added By: Svetlana (DevExpress Support) at: 9/23/2015 11:48:28 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T292977: How to prevent a popup from being closed. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to use XtraSpellChecker in XAF

$
0
0

Scenario
This example demonstrates how to incorporate the XtraSpellChecker to XAF applications.

Steps to implement
1. Copy the Spelling.Win project into your solution and build it;

2. Invoke the Application Designer for your executable WinForms project (YourSolutionName.Win) or the Module Designer for your WinForms module project (YourSolutionName.Module.Win) and open the Toolbox (Control+Alt+X);
3. Drag the SpellingWindowsFormsModule item from the Toolbox;
4. Build and run your project.

Important notes
If you are using RichEditControl, check out the Adding Richedit to Sample E736 thread for additional configuration.


UPDATED by Dennis:

Here you can download an improved version of the original example that illustrates another variant of integrating WinForms SpellChecker and ASP.NET WebForms ASPxSpellChecker components in XAF.
My attachment contains three custom XAF extra modules I developed + a small demo project to help you check what is done and how this works. 
Note that this is not a complete solution by any means, but just an example that demonstrates certain integration scenarios to help you implement a spell checking functionality in your end application. There may be issues, so feel free to research, test and modify the source code of these modules to better meet your business needs. I look forward to any feedback on these modules if you find any issues or have further suggestions.

Question Comments

Added By: Louis Z at: 5/15/2014 8:04:47 AM    

1. Copy the Spelling.Win project into your solution and build it;
2. Invoke the Application Designer for your executable project and open the Toolbox (Control+Alt+X);
3. Drag the SpellingWindowsFormsModule item from the Toolbox;
4. Build and run your project.

Added By: Tony Tadros at: 1/15/2015 9:53:11 AM    

Hello Devexpress ,this example is not working anymore ,do you have any update

Added By: Dennis (DevExpress Support) at: 1/16/2015 8:27:34 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T197752: SpellChecker integration in XAF 14.2. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.



Added By: Luke Kenyon 1 at: 9/24/2015 12:39:10 AM    

Hi, I just downloaded this and applied it to my project after converting the projects to the latest version. I did notice that it has added 2 button items to the menu for spell checking other than that it does the job which has saved me some time thanks.
Cheers Luke

Added By: Dennis (DevExpress Support) at: 9/24/2015 3:16:16 AM    @Luke: Thanks for taking your time to test this solution in your project and share your feedback with us. This module also adds a corresponding button in the toolbar for checking the whole form.

ASPxNavBar - How to bind a control to an XML file by using an XSLT file

$
0
0

When the ASPxNavBar is bound to XmlDataSource, the latter should suit the following structure:

[XML]
<Root><GroupText="Reports"><ItemText=" ... "NavigateUrl="..."ImageUrl="..."/></Group></Root>

In this case, XmlDataSource can retrieve and synchronize the Text, NavigateUrl and ImageUrl XML attributes with ASPxNavBar properties. However, in real applications, data seldom suits this structure. Most often, an XML schema contains several sub- nodes that describe some element. For instance:

[XML]
<Menus><Menutext="abc1"><ProductID>193</ProductID><ProductName>090 - Introduction</ProductName><PTName>Video</PTName></Menu></Menus>

XmlDataSource cannot parse such a schema. However, XmlDataSource allows specifying an XSLT file where you can define a transformation that will be applied to the specified DataFile. In this case, it is necessary to utilize the GroupContentTemplate. For example:

[XML]
<xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:templatematch="/"><Menus><xsl:for-eachselect="//Menus/*"><MenuText="{ProductName}"ProductID="{ProductID}"></Menu></xsl:for-each></Menus></xsl:template></xsl:stylesheet><GroupContentTemplate> ProductID:<asp:LabelID="Label1"runat="server"Text='<%# DataBinder.Eval(Container.Group.DataItem, "ProductID") %>'></asp:Label></GroupContentTemplate>

You can learn more about XML transformation files from the following sources:

Using XSLT files with the new XMLDataSource control
XSLT - Transformation

Question Comments

Added By: Ken Post 2 at: 9/24/2015 12:09:07 PM    

Various links are broken...

Added By: Alessandro (DevExpress Support) at: 9/24/2015 12:40:29 PM    Hi,

Thank you for pointing out this issue. I have corrected the broken link.

How to enforce password complexity in XAF

$
0
0

This task can be accomplished by validating user-entered passwords in the ChangePasswordOnLogonParameters and ChangePasswordParameters detail views. Here, we create a code rule to check password complexity using a custom function. This rule should be checked in a custom context, attached to the DialogOK action, because ChangePasswordOnLogonParameters is a non-persistent object, and the Save context is not appropriate for it.
Also, we have to explicitly initialize the validation rule set, otherwise validation won't work prior to user login.

For additional information, refer to the Non Persistent Objects Validation help topic.

Question Comments

Added By: Joël van der Meer at: 6/28/2012 5:42:49 AM    

This works perfect...but I can't figure out how to make it also work when resetting a password. Apartly it's another action or context, but wich?

Added By: Eduardo Jimenez at: 9/24/2015 2:52:42 PM    

We are having the same problem: password complexity is not being verified during password reset. Can you please indicate how to enable this under 'Change password on first logon'

How to add a watermark with a text or image to the document

$
0
0

This example illustrates how you can add a watermark to the document. The main idea is to add a corresponding Floating Object (TextBox or Picture) to the header section (see SubDocument essentials - simple examples). Take special note of the TextRenderer.MeasureText Method, which is used to calculate the correct size of a textual watermark.

See Also:
SubDocument.InsertPicture Method
SubDocument.InsertTextBox Method

Question Comments

Added By: TRAINEAU SOIZIC at: 10/24/2012 3:42:24 AM    

Don't work for me with the last build :
the text on the page (the real one : not the watermark text) disapears from left to right when zooming ... try to set the zoom at 200 %

Added By: TRAINEAU SOIZIC at: 10/24/2012 3:45:14 AM    

in fact it seems that it is a horizontal scrollbar problem ... try to zoom and play with Hscrolling

Added By: Anders Wang at: 9/4/2014 11:57:01 PM    

But, After you save as it to word, You can see the layout is corrupted by the watermark. So how to deal with it?

Added By: Elliot (DevExpress Support) at: 9/5/2014 6:32:17 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T147935: Corrupted document layout. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Anders Wang at: 9/23/2015 10:53:07 PM    

Hi,
for text watermark with chinese font (Simhei), your following shapesize calculaition code caused clipped watermark. The text cannot be fully displayed. Could you please help us? Thanks.
          Size sizeInPixels = TextRenderer.MeasureText(text, measureFont);
          shape.Size = new SizeF(Units.PixelsToDocumentsF(sizeInPixels.Width, richEditControl.DpiX), Units.PixelsToDoc

Added By: Andrey (DevExpress Support) at: 9/24/2015 8:18:12 AM    

Hello,
The issue occurs depends on the value returned by the standard System.Window.Forms.TextRenderer.MeasureText method and doesn't rely on our products.
To resolve the issue, increase a shape size as follows:

[C#]
shape.TextBox.Document.EndUpdateCharacters(cp);shape.TextBox.HeightRule=TextBoxSizeRule.Auto;shape.RotationAngle=-45;SizesizeInPixels=TextRenderer.MeasureText(text,measureFont);shape.Size=newSizeF(Units.PixelsToDocumentsF(sizeInPixels.Width,richEditControl.DpiX)+ 10,Units.PixelsToDocumentsF(sizeInPixels.Height,richEditControl.DpiY));


Please try this solution and let me know your results. 

Added By: Anders Wang at: 9/24/2015 6:23:53 PM    

Hi,
Really? Do you have check "Units.PixelsToDocumentsF"?


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

Refer to the following video to see the module features in action: http://www.screencast.com/t/h2goGEdZJc

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;

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.

DXGauges Getting Started - Lesson 1 - Create a Circular Gauge

$
0
0

This is the first tutorial of the DXGauges Getting Started series. It will guide you through the process of creating a Circular gauge and adjusting its common settings.

Question Comments

Added By: Michael Senfter at: 9/25/2015 3:39:40 AM    

Hi!
I have built a Circular Gauge. How can I set the value of needle in code and furthermore I want to bind this to my variable.currentValue ?

Added By: Michael Senfter at: 9/25/2015 3:50:18 AM    

ok. I 've found a example solution. thx

How to populate a List View with data from a LINQ query

$
0
0

Scenario

Sometimes it is important to show a readonly ListView with custom data obtained from the database, rather than through standard XPO mechanisms, by means of loading entire persistent objects.

While this custom data may include certain properties of your XPO classes, in a general case, it may come from anywhere, including but not limited to, a raw SQL query, stored procedure, database view or a very complex LINQ query returning only a subset of persistent class properties or even custom data fields. While the first scenarios can be solved by mapping a persistent class to a database view, the second group of scenarios is optimal in implementing a custom form/control (check How to show custom forms and controls in XAF (Example) for more details) or a custom CollectionSource.
Here, we will demonstrate how the latter option can be realized to display data from a custom LINQ query using the LINQ to XPO approach.

In particular, we want to show a list of employees with maximum orders:


Steps to implement

1. Include the XAF.LinqToXpo module project in your solution and make sure it builds successfully.

This module is supposed to generate custom ListView nodes in the Application Model with the _Linq suffix so that this ListView uses data returned by a predefined method (see the XPQueryMethod attribute for the ListView node) using LINQ.

To provide this custom ListView with data, a custom CollectionSourceBase class descendant is implemented (see the XAF.LinqToXpo\LinqCollectionSource.xx file). It is enabled for a custom ListView via the XafApplication.CreateCustomCollectionSource event (see the XAF.LinqToXpo\Module.xx file).


2. Invoke the Module Designer for YourSolutionName.Module project and drag and drop the XafLinqToXpoModule component to the Required Modules list (this component should automatically appear in the Visual Studio Toolbox after executing the previous step).


3. Implement the public static methods that accept DevExpress.Xpo.Session as a parameter and return System.Linq.IQueryable as a result in your persistent classes, where required.

Consider the following signature for more clarity: public static System.Linq.IQueryable MethodName(DevExpress.Xpo.Session session);

Within the method body, use the LINQ to XPO approach to return a required data set based on XPQuery<T>. If you want to return a custom property as part of your data set which does not exist within your XPO data model, then include it into the selected part of the query with a custom name (e.g., Employee_Linq, Orders_Sum_Linq, etc.).

Mark these methods with the XAF.LinqToXpo.QueryProjectionsAttribute to specify that comma-separated names of data properties will be included as a query result.

Refer to the NorthwindDemo.Module\PersistentObjects.xx for an example.


4. Invoke the Model Editor for YourSolutionName.Module project and add custom calculated fields with dummy expressions for each specified custom property which is not part of your default XPO data model. Refer to the NorthwindDemo.Module\Model.DesignedDiffs.xafml file for an example.


IMPORTANT NOTES

1. This example uses the Northwind database for testing. You can download the database creation scripts for testing from here.

2. Since a Linq-based ListView may contain custom data sets and not entire persistent objects in a general case, certain standard Controllers are disabled here (e.g., you cannot open a detail form for this data record or create a new object). Refer to the XAF.LinqToXpo\DisableStandardActionsLinqListViewController.xx file for more details.

3. If you want your default ListView to include custom calculated values, then it is possible to use the built-in Custom Fields feature for that purpose.

Question Comments

Added By: Artem G. at: 9/25/2015 4:02:41 AM    

Hello Dennis. Sorry, but your code doesn't work in my simple test project.
1. First problem is that I throws an exception like "Unable to cast object of type 'ModelListView' to type 'XAF.LinqToXpo.IModelListViewLinq'."
It happens not on run, but when I open XAF Model Editor in VS. It doesn't like the line:  
   listViewInfo = (IModelListView)node.AddNode<IModelListView>(id);
in class  ModelListViewLinqNodesGeneratorUpdater.
If I comment it, Editor works fine.

2. While I have created the entities in business object folder of Model  like Customer, Employee, Orders, they have appeared in views (as any other business object), but If I try to set my custom created view with _Linq suffix to nodes, it doesn't want to work, doesn't load objects (Customer). Maybe it's a  the default behaviour works, not your code? Otherwise it even doesnt enter the most part of code in ModelListViewLinqColumnsNodesGeneratorUpdater because it doesn't find any XPQueryMethod method (XPQueryMethod == null)

3. Somehow only view with name Customer_ListView_CustomersLInq_Linq  appears in Model Editor. Others don't. Maybe because of problem from (1). I set it to my node, but it didn't load data (problem 2)

4. I'm not sure that it's a real important to get data from linq, but it's much more important for all community to show one good example with stored procedures and link this post no more. All link  from forum references this article. But I doesn't clarify how can I use SP and where. Could you pls provide an example project with SP. Or at least a working project with this code

Regards, Artem

Added By: Artem G. at: 9/25/2015 4:03:35 AM    

I used last version of code. My XAF version is 13.2.10 (can't and woudn't upgrade, becase of project convert problems)

Added By: Artem G. at: 9/25/2015 4:28:47 AM    

And also such behaviour like "you cannot open a detail form for this data record " is very-very bad. Are there any solutions?
I just exmplane a simple use-case, where it's required:
1. You need a user audit statistics to be show like  "department",  "action", "total users", "total visits"
2. All these "totals" have to be calculated on DB level with stored procedure. So I need all this workaround to be used.
3. On details click I want to see the full statistics about department: exact list of users and their actions.

So, how can I show details ?

Custom Editor - How to create a custom editor allowing you to display a readonly HTML formatted text

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

How to bind the XtraScheduler with multi-resource appointments to XPO

$
0
0

Problem:

How can I bind the XtraScheduler to eXpress Persistent Objects, if an Apppointment Storage contains multi-resource appointments (the AppointmentStorage.ResourceSharing property is set to true). I've already read KB aritcle #A2787 (How to bind the XtraScheduler to XPO), but it doesn't help much.

Solution:

To accomplish this task, perform the following steps:

1. Add the DevExpress.Xpo.vX.y.dll assembly to the references list of the project.

2. Declare XPAppointment and XPResource classes (derived from XPObject).

3. Rebuild the application, so that these objects can be used for the XPCollection.

4. Drop two XPCollection components from the toolbox onto a Form and name them xpCollectionAppointments and xpCollectionResources.

5. Set their ObjectClassInfo properties to the XPAppointment and XPResource objects, respectively.

6. Set the SchedulerStorage.Appointments.DataSource property to xpCollectionAppointments, and the SchedulerStorage.Resources.DataSource property to xpCollectionResources.

7. Specify all required mappings for the AppointmentStorage and the ResourceStorage.

8. Handle the SchedulerStorage.AppointmentsChanged and SchedulerStorage.AppointmentsInserted events using the event handler which calls the XPBaseObject.Save method. The event handler is the same for both events.

This approach is illustrated by the sample project.

Question Comments

Added By: JJDX at: 9/27/2015 2:27:40 AM    

Could you please redone example to be opened in Visual Studio 2012

Viewing all 7205 articles
Browse latest View live


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