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

How to draw custom separators for GridColumns and GridControlBands

$
0
0

This example demonstrates how to draw custom separators for GridColumns and GridControlBands.


Important! Starting with version 18.1 GridControl supports this feature out of the box. Please refer to the Band Separators article for detailed information.


For versions prior to 18.1, you can use the approach listed below:


To accomplish this task, override GridColumnHeader's ControlTemplate and add an additional border. Then, create a custom class with two attached properties and two converters. In the first converter, return a new Thickness value. In the second converter, return a Boolean value depending on the incoming value type: true if it is GridColumn or GridControlBand, and false in other cases.  
After that, bind a border's BorderBrush and BorderThickness properties to these attached properties using the first converter for the BorderThickness property and add an additional DataTrigger to ControlTemplate to change the border visibility using the second converter.


Win Viewer - How to apply default filtering to master filter items that affect each other

$
0
0
The DashboardViewer control allows you to apply default filtering using the following events:
- MasterFilterDefaultValues.
- RangeFilterDefaultValue.
FilterElementDefaultValues (v16.1 and earlier).
- SingleFilterDefaultValue (v16.1 and earlier).

Note:
If the Neutral Filter mode (v18.2.4 and higher) is enabled, master filters apply as expected and the workaround described in this document is not relevant.

If your dashboard contains several master filter items that affect each other, filtering may not be applied to some items due to architectural limitations of DevExpress Dashboard. Let's consider the following scenario: a dashboard contains the Grid and Card dashboard items that affect each other. If you handle the MasterFilterDefaultValues event for both items, filtering will not be applied to the Extended Price column of Grid 1:
code:
[C#]
privatevoiddashboardViewer1_MasterFilterDefaultValues(objectsender,MasterFilterDefaultValuesEventArgse){if(e.ItemComponentName=="gridDashboardItem1")e.FilterValues=e.AvailableFilterValues.Where(v=>(string)v["CategoryName"]=="Beverages"||(string)v["CategoryName"]=="Condiments");if(e.ItemComponentName=="cardDashboardItem1")e.FilterValues=e.AvailableFilterValues.Where(v=>(string)v["Country"]=="UK");}
 result:



As a workaround, you need to call the SetMasterFilter method for Cards 1. In this case, filtering will be applied correctly:
code:
[C#]
dashboardViewer1.SetMasterFilter("cardDashboardItem1",newList<object>(){"UK"});// ...privatevoiddashboardViewer1_MasterFilterDefaultValues(objectsender,MasterFilterDefaultValuesEventArgse)if(e.ItemComponentName=="gridDashboardItem1"){e.FilterValues=e.AvailableFilterValues.Where(v=>(string)v["CategoryName"]=="Beverages"||(string)v["CategoryName"]=="Condiments");}
result:

How to load skin images at runtime

How to create a Custom Appointment Edit Form

$
0
0
To learn more see the Getting Started article.
Question Comments

Added By: Stephan Y. at: 10/31/2016 2:29:55 AM    Hello,

in Lesson 7 is described how to create a custom Appointment Edit Form with the DevExpress.XtraScheduler.UI.AppointmentForm.

But I need to create a Appointment Edit Form with a "normal" devexpress form, just like you do it with this code example.
This code is a little bit more complex like the code in the lesson 7.
So have have a document with some remarks or explanations for this code?

BR
Stephan

Added By: Yulia (DevExpress Support) at: 10/31/2016 8:29:26 AM    

Hello Stephan,

The Custom Appointment Edit Form section of the Getting Started help topic describes how to create a custom Appointment Edit Form using the smart tag of the SchedulerControl. This form is a descendant of the DevExpress.XtraEditors.XtraForm class and implements the IDXManagerPopupMenu interface. The SchedulerControl generates code behind for this form automatically. Please note that this feature is available starting from v15.2.

If you are using older versions of our controls, you can use the approach described in the Custom form, custom fields and custom actions on reminder alert Code Example to create a custom Appointment Edit Form from scratch (inherit the form from the  DevExpress.XtraEditors.XtraForm class).

If you face any difficulties with the aforementioned approach, please create a separate ticket, describe the issue and provide a small sample that shows the problem. We will do our best to help you.

PropertyGridControl - How to apply Data Annotation Attributes to a data source on the fly

How to display notifications by implementing the IDataErrorInfo interface

$
0
0

Please implement the IDataErrorInfo interface on the data object. Then, pass the text and type of error in the IDataErrorInfo.Error property ( it is possible to easily parse this string). Implement a custom style for the ErrorControl. This element presents the error icon. Modify the ErrorControl style in such a way as to take into account a custom error type and text (use the converter).


Question Comments

Added By: Gavrilo Mumovic 1 at: 10/28/2016 4:54:13 AM    How does this apply to GridControl?Added By: Alexander Rus (DevExpress Support) at: 10/28/2016 8:26:08 AM    

Hi Gavrilo,
I've created a separate ticket on your behalf (T444786: Different validation icons in GridControl when IDataErrorInfo is used). It has been placed in our processing queue and will be answered shortly.

Thanks,
Alexander

Added By: Natasja Patry at: 8/28/2017 5:51:00 AM    Is this also supported by POCO view models?Added By: Ivan (DevExpress Support) at: 8/28/2017 10:57:30 AM    Hi Natasja,

Since you created a new ticket about this issue - Input validation warning with POCO view model - let's continue our discussion in that ticket. I will reply to you there shortly.

MvvmExpenses Sample Application

$
0
0
This is a sample application, created in MVVM Tutorials section. Follow this link to see these lessons. In addition, refer to the WinForms MVVM help article to learn key MVVM concepts.

To log in, use one of the following credentials:
Administrator - admin
John - qwerty
Mary - 12345
Guest - (no password set)
Question Comments

Added By: Hedi Guizani at: 6/17/2015 12:58:21 PM    

Can we have the same exemple but using xpo please

Added By: Alisher (DevExpress Support) at: 6/18/2015 10:06:09 AM    

Hi Hedi,

At present, our scaffolding wizard does not support XPO. Once we support this functionality, we will inform you. We don't have plans to modify sources of our tutorials including this example, however, be sure that once we support XPO with a scaffolding wizard, you'll be able to generate correct view models for working with data.

Added By: Hedi Guizani at: 6/18/2015 12:34:35 PM    

Fair enough,
The only thing I may ask is how soon xpo will be supported by the scaffolding wizard?
I m gone through the learning curve of xpo thinking devx will favore if over EF but it seems it is not the case, sometimes I m really lost without a clear road map, XAF or Mvvm, XPO or EF, wf or wpf, mvc or extreme, I think .net roadmap is unclear enough so guys please just show as the path and we will follow you ;)

Added By: Alisher (DevExpress Support) at: 6/19/2015 7:38:52 AM    

Hedi,

I am afraid I can't provide you with any ETA on when we will implement this functionality. We will certainly inform you once it is implemented. As for the roadmap, we don't have a Roadmap for 2015 and will unlikely generate any future road maps. I suggest that you check Vache's comment in the Is there any public roadmap for 2015.1 available? ticket.
Let me know if you have additional questions.

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. 

Note that starting with version 15.2, this functionality is accessible out of the box. To enable it, set the TreeList.OptionsDragAndDrop.DragNodesMode property to Single or Multiple.

Use this approach for versions older than 15.2 or if you need to provide your own drag-and-drop logic. 

See Also:
E415 

Search keywords: 

TreeList, drag-drop in TreeList, TreeList drag-drop, TreeList drag nodes, TreeList drag and drop nodes


How to: display the loading panel for WinForm controls

$
0
0

Our WinForms Suite has the Splash Screen Manager component that can be used to indicate that the application is busy. A regular approach that is commonly used is enabling the Application.UserWaitCursor option. The Splash Screen Manager allows you to show custom loading panels with your own design instead.

To learn more about the capabilities provided by the component used in this example, refer to the Wait Form document in our online documentation.

Another way to point out to an en-user that the application is in a busy state is to use our Overlay Form. This is a semi-transparent splash screen that overlaps a control or an entire form and prevents users from interacting with this control. Please review the mentioned documentation topic for additional information. You can also tun the Overlay Form module in the XtraEditors MainDemo to see the form in action.

Question Comments

Added By: YJ0702 at: 3/14/2013 1:27:33 PM    

How can i use 'WaitForm' when child form is loading?
I want to display loading panel when child form is loading... thanks.

Added By: Wiley Siler 1 at: 2/20/2017 7:36:33 AM    How can this be about WinForms if it is for ASP.NET?Added By: Uriah (DevExpress Support) at: 2/22/2017 3:33:10 AM    Hello Wiley,

Thank you for your feedback. I have re-worked the example description to provide more details about the component used here. Feel free to contact us again if you have additional questions.

How to filter a LookUpEdit in one column based on the value of another column

$
0
0

This example illustrates how to filter LookUpEdit items based on the value of another column.

To provide this functionality, we show cell editors using the CellTemplate property. Unlike EditSettings, this property allows you to display independent editors with different ItemsSource collections.

The ItemsSource collection is filtered in the ShownEditor event handler and is set to its original value in the HiddenEditor event handler.

The last step - setting ItemsSource to the original value - is required since GridControl creates visual elements only for visible rows and will re-use cell editors on scrolling rows. Since editors with the DisplayMember/ValueMember property set show only values from the ItemsSource collection, values in other cells may disappear if you skip this step.

Question Comments

Added By: David Stewart DK at: 1/2/2013 2:11:18 PM    

Notice that in the code below, the Name of the LookUpEdit MUST be "PART_Editor". This particular bit of magic was not clear to me...

/David

Added By: ArunKallingal at: 12/26/2013 5:07:38 AM    

Actually i want this in mvvm concept

Added By: Thomas R Melinsky at: 5/2/2014 4:47:23 AM    

I have compiled this with 12.2.8 and 13.2.7, and it has odd behavior with both.  Sometimes when viewing the cities list, there will only be one item in the list, the chosen city.  Other times when viewing the same city list (or another list item that has the same country selected), it will display all of the city choices.  Is it possible to fix the example as I was planning on using it as a reference?

Added By: Elliot (DevExpress Support) at: 5/2/2014 5:14:23 AM    

As an immediate solution, you can use the approach described in the E2163 code example to avoid this problem. Does it work for you?

Added By: John Genske at: 1/27/2016 6:04:56 AM    

We were looking for this answer forever, Two thumbs up!!

Added By: Andrey Marten (DevExpress Support) at: 1/27/2016 10:43:11 AM    
Hello John,

I'm happy to hear that the approach described in this example is suitable in your scenario. Please do not hesitate to contact us if you have other questions. We will be happy to assist you. 


Thanks,
Andrey

Multiple selection using checkbox (web style)

$
0
0

Important note.

Starting with version 13.2GridView 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.

Starting with version 18.1, in multiple row selection mode, you can sync row selected states with a Boolean field in the bound data source. The selection binding mode ensures that row selection persists whenever you filter or group grid data. Refer to the Multiple Row Selection via Built-In Check Column and Selection Binding help article for more information. 


For earlier versions:

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 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 Added By: Svetlana (DevExpress Support) at: 11/2/2018 6:12:50 AM    

Hello,

I've created a separate ticket on your behalf (T687254: How to enabled the Right-to-Left mode in the E1271 example ). It has been placed in our processing queue and will be answered shortly.

How to: Use Google, Facebook and Microsoft accounts in ASP.NET XAF applications (OAuth2 demo)

$
0
0
This example demonstrates the use of OAuth2 authentication in a web application. Users can sign in to the application via Google, Facebook or  Microsoft authentication providers.


You can try this demo "as is" to overview its capabilities, and then try the demonstrated functionality in your own XAF applications according to the instructions below.


How to Run this Demo

Before running this demo, register developer accounts at the services you are going to use:
https://console.developers.google.com/
https://developers.facebook.com/
https://apps.dev.microsoft.com/ 

Open the Web.config file and specify your own client IDs and client secrets for each provider.

[XML]
<appSettings><addkey="GoogleClientID"value="YourGoogleClientID"/><addkey="GoogleClientSecret"value="YourGoogleClientSecret"/><addkey="FacebookClientID"value="YourFacebookClientID"/><addkey="FacebookClientSecret"value="YourFacebookClientSecret"/><addkey="MicrosoftClientID"value="YourMicrosoftClientID"/><addkey="MicrosoftClientSecret"value="YourMicrosoftClientSecret"/>

You can remove keys corresponding to providers that you do not want to use. 


Now you can run the application.


Overview of this Demo Capabilities


In the logon window, there are buttons for each provider specified in Web.config:


Standard XAF authentication with built-in username/password is also supported. When you log in via OAuth authentication, the email is used as a user name. By default, a user object is autocreated for each logon. You can disable autocreation, or specify the auto-assigned role for new users in the InitializeComponent method (see WebApplication.cs(vb)):
[C#]
this.securityStrategyComplex1.NewUserRoleName="Default";((AuthenticationStandartWithOAuth)authenticationBase).CreateUserAutomatically=true;
[VB.NET]
Me.securityStrategyComplex1.NewUserRoleName = "Default"CType(authenticationBase, AuthenticationStandartWithOAuth).CreateUserAutomatically = True
When CreateUserAutomatically is false, the logon is allowed if a user with the email returned by the external service exists in the application database. To grant access to a user with a specific e-mail, use the built-in Admin account, create a user object and set the UserName to this e-mail.



If you set the EnableStandardAuthentication property to true for an auto-created user, this user will be able to login directly, with a user name and password. Note that the password is empty by default, so do not forget to specify it when enabling standard authentication.



Each user can have several associated email addresses. To add or remove email addresses, use the  OAuth Authorization Emails list in the user's Detail View.



How to Implement the Demonstrated Functionality in your XAF Application
 

1. In your solution, open Package Manager Console.
  1.1. Choose the YourSolutionName.Web project in the Default project combo box, and execute the following commands to add Owin packages:
  Install-Package Microsoft.Owin -Version 3.1.0
  Install-Package Microsoft.Owin.Security -Version 3.1.0
  Install-Package Microsoft.Owin.Security.Cookies -Version 3.1.0
  Install-Package Microsoft.Owin.Host.SystemWeb -Version 3.1.0
  Install-Package Microsoft.Owin.Security.Google -Version 3.1.0
  Install-Package Microsoft.Owin.Security.Facebook -Version 3.1.0
  Install-Package Microsoft.Owin.Security.MicrosoftAccount -Version 3.1.0
  1.2. Switch to the YourSolutionName.Module.Web project and install these two packages:
  Install-Package Microsoft.Owin -Version 3.1.0
  Install-Package Microsoft.Owin.Host.SystemWeb -Version 3.1.0

2. Open the Web.config file and specify your own client IDs and client secrets for each provider you are going to use. Refer to the AuthenticationOwin.Web\Web.config file in the demo solution to see the example. Then, set the authentication mode to "None" and comment or remove settings related to the default XAF authentication:
[XML]
<authenticationmode="None"/><!--<forms name="Login" loginUrl="Login.aspx" path="/" timeout="10" />--></authentication><!--<authorization> <deny users="?" /> <allow users="*" /> </authorization>-->

3. Copy the following files from the demo solution to the corresponding locations within your solution:
- AuthenticationOwin.Module\AuthenticationStandartWithOAuth.cs(vb)
- AuthenticationOwin.Module\IAuthenticationOAuthUser.cs(vb)
- AuthenticationOwin.Module.Web\Controllers\LogonAuthController.cs(vb)
- AuthenticationOwin.Module.Web\Security\CustomSecurityStrategyComplex.cs(vb)
- AuthenticationOwin.Module.Web\Controllers\LogonAuthController.cs(vb)
- AuthenticationOwin.Module.Web\Images\Facebook.svg
- AuthenticationOwin.Module.Web\Images\Google.svg
- AuthenticationOwin.Module.Web\Images\Microsoft.png

- AuthenticationOwin.Web\Startup.cs(vb)
AuthenticationOwin.Web\LogonTemplateContent1.ascx
AuthenticationOwin.Web\LogonTemplateContent1.ascx.cs(vb)
AuthenticationOwin.Web\LogonTemplateContent1.ascx.designer.cs(vb)
Include the copied files to your solution (Add | Existing Item...). Update the namespace names in the copied code files to match namespaces you use in your solution. For image files, set the Build Action property to Embedded Resource.

4. Edit the YourSolutionName.Module\Module.cs file. In the overridden Setup method, handle the XafApplication.CreateCustomLogonWindowControllers event and add the LogonAuthController to the e.Controllers collection passed to this event. Refer to the AuthenticationOwin.Module.Web\Module.cs(vb) file to see an example.

5. Edit the YourSolutionName.Web\WebApplication.cs(vb) code and register this custom security strategy:
[C#]
this.securityStrategyComplex1=newAuthenticationOwin.Module.Web.Security.CustomSecurityStrategyComplex();
[VB.NET]
Me.securityStrategyComplex1 = New AuthenticationOwin.Module.Web.Security.CustomSecurityStrategyComplex()

6. Implement the IAuthenticationOAuthUser interface in your custom user class. You can see an example in the AuthenticationOwin.Module\BusinessObjects\OAuthUser.cs file. If you use the built-in user, you can copy the OAuthUser class to your project from the demo and set the SecurityStrategy.UserType property to OAuthUser in the Application Designer.

7. Change the code that creates your predefined users in YourSolutionName.Module\DatabaseUpdate\Updater.cs. Set EnableStandardAuthentication to true for users who can login with standard authentication (username and password). See the example in the AuthenticationOwin.Module\DatabaseUpdate\Updater.cs file.

8. Register the LogonTemplateContent1.ascx template in the YourSolutionName.Web\Global.asax.cs file:
[C#]
WebApplication.Instance.Settings.LogonTemplateContentPath="LogonTemplateContent1.ascx";
[VB.NET]
WebApplication.Instance.Settings.LogonTemplateContentPath = "LogonTemplateContent1.ascx"

9. Copy the LoginWith* actions customizations and the AuthenticationStandardLogonParameters_DetailView layout settings from the AuthenticationOwin.Module.Web\Model.xafml file to the same file in the YourSolutionName.Web project. If you have no model customizations in Model.xafml, you can just overwrite it with the file from demo. Ensure that the IsPostBackRequired property of each LoginWith* action is set to true.


Tip: You can refer to the OWIN OAuth 2.0 Authorization Server documentation to learn how to add more authentication providers.

For an example of integrating OAuth2 authentication in a WinForms XAF application, refer to the XAF - OAuth2 Authentication for WinForms ticket.

Important note
This example shows how XAF can work with OAuth2, in particular, how XAF can get a user's email from a service that uses this framework, and create (or authenticate) a user based on it (the AuthenticationStandartWithOAuth.Authenticate method). The API and settings of services (Google, Facebook, and Microsoft) that we use in this example often change and we can't always keep this example up to date with them. Moreover, we often can't handle these changes in our example. For example, Microsoft requires the '/signin-microsoft' string to the Redirect URI or Google requires to enable the Google+ API. If you face difficulties with the authenticate process in this example, refer to the used OAuth2 service's documentation and make sure that all settings are correct. Feel free to create merge requests to this example if needed.

Question Comments

Added By: Scott Gross at: 7/14/2017 8:43:09 AM    Will this work with XAF Mobile as well?Added By: Konstantin B (DevExpress) at: 7/16/2017 11:07:04 PM    We haven't yet tested this approach with XAF Mobile. However, we will consider including the mobile app project to this demo. I've created a separate ticket on your behalf (T536304: OAuth2 authentication in XAF Mobile). It has been placed in our processing queue and will be answered shortly.Added By: Rik Pronk at: 8/1/2017 6:41:49 AM    In the sample project, I noticed some errors in the web.config file. Below 'For applications with a security system' the <Authentication> tag is used, but that's supposed to be the <authorization> tag instead.Added By: Konstantin B (DevExpress) at: 8/1/2017 8:49:03 AM    Hello Rik,

Your comment is correct, we have updated this demo. Thanks!  Added By: Martin Svärd at: 8/31/2017 3:40:34 AM    Hi Konstantin,

I am not able to try this example, even though I register it with Microsoft.
Am I missing something?
And will this work with Microsoft Azure as well, or is it only Microsofts non O365 accounts? Added By: Dennis (DevExpress Support) at: 8/31/2017 3:55:20 AM    @Martin: Thanks for your interest. I've created a separate ticket on your behalf (T550911: Difficulties when running the T535280 example (OAuth2 authentication)). It has been placed in our processing queue and will be answered shortly.Added By: Genesis Supsup (QuickZ) at: 10/23/2017 8:56:59 PM    Is it possible to implement this in XAF using Windows Forms?Added By: Dennis (DevExpress Support) at: 10/24/2017 12:02:24 AM    @Genesis Supsup: We will answer you in the XAF - OAuth2 Authentication for WinForms ticket. Thanks.Added By: Vince G at: 1/21/2018 11:02:19 AM    For Google Authentication you will need to enable the Google+ API otherwise the google authentication won't work, that took me a while to debug.

How to change the Field Value Header appearance backcolor or draw it manually

$
0
0

Update:
Starting with version 18.2.3, you can change the Field Value background color by setting the corresponding Appearance.BackColor property. In this case, the Skin background image will be ignored and we will manually draw the background using the specified color.

If UserLookAndFeel.Style is equal to Skin, the XtraPivotGrid control uses the Skins technology to draw its content. With this approach, all headers are drawn using a specific bitmap provided by a corresponding skin element. The appearance back color settings have no effect in this instance. If you want to draw a field header using a custom color, you can draw the field header manually using the PivotGridControl.CustomDrawFieldValue event.

Note that the DrawIndicator method can throw exceptions in versions 15.1.3 - 15.1.5. We have fixed this issue in the context of the DrawIndicator method call throws an exception after updating to 15.1.5 ticket.

ASPxPivotGrid - How to provide custom summary values for Total, Grand Total and ordinary cells

$
0
0

This example demonstrates how to determine the value type when you calculate custom summary values.
1. Set the data field's SummaryType property to Custom to perform calculations manually, by handling the CustomSummary event.
2. Use the PivotGridCustomSummaryEventArgs.ColumnField and PivotGridCustomSummaryEventArgs.RowField properties to determine the kind of a processed cell. You can use the following rules to determine that a cell is being processed:

    a. If ColumnField or RowField is null, it means that this is a Grand Total cell;
    b. If both ColumnField and RowField are last fields in a corresponding area, this means that this is an ordinary cell.
    c. In other cases, this is a Total cell.

See Also
E1877: How to Implement Custom Summary 
T158425: How to calculate Total cell values based on the low level Cell summary values

Example versions for other platforms:
T555679: How to provide custom summary values for Total, Grand Total and ordinary cells for WinForms PivotGridControl
T555636: How to provide custom summary values for Total, Grand Total and ordinary cells for WPF PivotGridControl

Question Comments

Added By: Eurofins Lancaster Labs at: 10/12/2012 10:16:06 AM    

How can we override the bottom right grand total (total of grand totals)?

Added By: Eurofins Lancaster Labs at: 10/12/2012 11:17:42 AM    

Nevermind, I just had to loop through the items in the drill down data source.

Bind a Scheduler to MS SQL Database at Design Time


How to make the grid always be sorted by a particular column

$
0
0

This example demonstrates two modes of sorting a predefined column (EmployeeID) in respect to the column selected by an end-user (Number).
The first mode assumes that the predefined column will be always sorted after the selected one:

The second mode illustrates that the predefined column is sorted before any selected column:

ASPxRichEdit - How to insert RTF text to a document

$
0
0

Starting with version 18.1, the ASPxRichEdit control provides the insertRtf command, which allows you to add formatted RTF content at the specified position.

In versions prior to 18.1, ASPxRichEdit doesn't provide a functionality to insert RTF formatted text on the client side so that this format is applied automatically. This example demonstrates a workaround that allows you to insert formatted RTF text to the current document on a button click via an ASPxRichEdit callback.


To implement this scenario, initiate an ASPxRichEdit custom callback via the client-side ASPxClientRichEdit.PerformCallback method and handle the server-side ASPxRichEdit.Callback event. To add the required text in this event handler, you can use the AppendRtfText method of our non-visual RichEditDocumentServer component.
To insert this text at the current caret position in the middle of a document text, obtain this position on the client side by using the RichEditSelection.intervals array object and pass it to the server as a parameter of the ASPxClientRichEdit.PerformCallback method. Then, access this passed value in the server-side Callback event handler and use it to modify the current document position via the Document.CreatePosition method before inserting RTF text.

ASPxDashboard - How to load and save dashboards from/to a database

$
0
0

This example shows how to create a custom dashboard storage that allows storing dashboards in a data base. It uses the System.Data.SqlClient members to connect and operate an MS SQL server data base. 

A custom dashboard storage should implement one of the following interfaces: IDashboardStorage or IEditableDashboardStorage.

IDashboardStorage provides functionality to open and edit dashboards available in the storage. 
XDocument LoadDashboard(string dashboardID) - returns a dashboard by its ID in the XDocument format, which describes an object model of the dashboard.
IEnumerable<DashboardInfo> GetAvailableDashboardsInfo() - returns a list of IDs and Captions of dashboards available in the data storage.
void SaveDashboard(string dashboardID, XDocument dashboard) - updates the dashboard with new settings by its id.

IEditableDashboardStorage inherits the IDashboardStorage interface and contains one additional method that allows adding new dashboards to the storage.
string AddDashboard(XDocument dashboard, string dashboardName) - takes a dashboard definition with its caption, saves it to the data storage, and returns the ID of a new saved dashboard.

Additionally, this example contains an SQL query and data base backup file,  which can be used to recreate a data base used in this example on your side.

See also: 
How to save dashboards created in ASPxDashboard to a DataSet
MVCxDashboard - How to save dashboards to a data base

This example applies to the Web Dashboard Designer starting from v2016 vol 1. To learn how to achieve this goal in previous versions, refer to the OBSOLETE - ASPxDashboardDesigner - How to save dashboards to a data base example.

Question Comments

Added By: James Badenhorst 1 at: 7/4/2016 1:41:46 AM    Hi DevExpress,
Quote from above...
"Additionally, this example contains an SQL Server data base backup file and....."
Sorry, but there is no Database backup file that I can find. There is a script to create an empty database, but that is all.
Please would you be kind enough to rectify.
Regards
James
Added By: John (DevExpress Support) at: 7/4/2016 2:21:41 AM    Hi James,
I have attached this backup file to the initial post.Added By: James Badenhorst 1 at: 7/4/2016 8:32:39 AM    Many thanks John - Is there any chance at all we might see an MVC example in the near future.
Regards
James
Added By: James Badenhorst 1 at: 7/4/2016 8:50:40 AM    John,
Apologies - cant find it. The original script to build the table starts off as
"USE [T386418]
GO"
So I am assuming the backup file would be "T386418.bak". Please correct me if I am wrong.

POI - The example runner on this page does not seem to like or open the project in VS2010 (Our company default).
I have VS2015 installed, however the example runner always tries to open in VS2010 first, and fails with an incompatibility error. Have to close it down, navigate to folder and re-open with VS2015. Have not seen this behaviour before.
Regards
James
Added By: James Badenhorst 1 at: 7/4/2016 9:23:05 AM    John,
Having created my own SQL database called T386481, and created the Dashboards table for the dashboard storage, run the app and get the error in the bottom right of the screen "An error occured on an attempt to load the list of available data sources". Putting a breakpoint in the Application_Start method of the  Global.asax.cs file (where the Access97 connection string is set for the CustomerReports view), this is not being hit before the app errors.
Many Thanks
James


Added By: John (DevExpress Support) at: 7/5/2016 6:02:53 AM    >>Is there any chance at all we might see an MVC example in the near future.
Thank you for your suggestion. We will prepare this example in the future.

>>I have VS2015 installed, however the example runner always tries to open in VS2010 first, and fails with an incompatibility error. Have to close it down, navigate to folder and re-open with VS2015. Have not seen this behaviour before.
Give me some additional time to research this behavior.

>>run the app and get the error in the bottom right of the screen "An error occured on an attempt to load the list of available data sources". Putting a breakpoint in the Application_Start method of the  Global.asax.cs file (where the Access97 connection string is set for the CustomerReports view), this is not being hit before the app errors.

I have created a separate ticket for this question on your behalf: ASPxDashboardDesigner - save dashboards to a data base implementation. Let's continue our discussion there.Added By: James Badenhorst 1 at: 7/5/2016 6:25:59 AM    John,
Many thanks for your response.
Is there any news on the missing database with the report definitions?
Best regards
James
Added By: John (DevExpress Support) at: 7/6/2016 6:15:34 AM    Hi James,
I have updated this example projects.Added By: James Badenhorst 1 at: 7/6/2016 6:36:32 AM    John,
Works straight out the box.
Once again Many Thanks
James
Added By: Gregory Lange 1 at: 10/13/2016 8:23:25 AM    So if i am understanding correctly we need to make the class that implements the IEditableDashboardStorage like your example that then points to the database which will load or save the xml data to an xml column? Added By: John (DevExpress Support) at: 10/13/2016 8:34:00 AM    Yes Gregory. You are correct.

MVC Dashboard - How to load and save dashboards from/to a database

$
0
0
This example shows how to create a custom dashboard storage that allows storing dashboards in a data base. It uses the System.Data.SqlClient members to connect and operate an MS SQL server data base. 

A custom dashboard storage should implement one of the following interfaces: IDashboardStorage or IEditableDashboardStorage.

IDashboardStorage provides functionality to open and edit dashboards available in the storage. 
XDocument LoadDashboard(string dashboardID) - returns a dashboard by its ID in the XDocument format, which describes an object model of the dashboard.
IEnumerable<DashboardInfo> GetAvailableDashboardsInfo() - returns a list of IDs and Captions of dashboards available in the data storage.
void SaveDashboard(string dashboardID, XDocument dashboard) - updates the dashboard with new settings by its id.

IEditableDashboardStorage inherits the IDashboardStorage interface and contains one additional method that allows adding new dashboards to the storage.
string AddDashboard(XDocument dashboard, string dashboardName) - takes a dashboard definition with its caption, saves it to the data storage, and returns the ID of a new saved dashboard.

Additionally, this example contains an SQL query and data base backup file,  which can be used to recreate a data base used in this example on your side.

See also:  ASPxDashboard- How to save dashboards to a data base

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.
Viewing all 7205 articles
Browse latest View live


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