This example illustrates how to create custom security objects, such as permissions, roles and users. We will implement a permission that allows administrators to secure the exporting functionality in an XAF application. The complete description is available in the How to: Implement Custom Permission, Role and User Objects topic. Image may be NSFW. Clik here to view.
Question Comments
Added By: Leong Vai Long at: 4/30/2014 3:24:41 AM
Hi DX, How can I rename these 7 SecuritySystem* tables in database? How to change their Oid to Int64 instead of GUID? My other BOs are inheriting from XPObject. Thanks.
To accomplish this task, you should create a new PivotGridField, bind it to the DataField, and hide the grand totals for this field via the PivotGridFieldOptions.ShowGrandTotal property. After that, you will need to manually calculate a display text for this field in the PivotGridControl.CustomCellDisplayText event, as shown in the example project.
This example demonstrates how to display a disabled button for particular cells depending upon some condition. This task can be accomplished by creating a custom button editor. Please refer to the Custom Editors article to learn more about custom editor creation.
The described solution is based on overriding the OnBeginPaint() method of a custom ViewInfo class. This method is called before drawing the editor and applies a desired button state depending upon the condition. Additionally, the RepositoryItemCustomButtonEdit.GetButtonState event is implemented. Subscribing to this event allows a customer to pass any custom condition to the editor. The GetButtonState event handler has the ButtonStateEventArgs parameter, which contains a GridCellInfo class instance as the Tag property. Necessary GridControl data can be obtained from the Tag object.
This example shows how to put columns and data summary definition logic in the ViewModel and setup the Grid Control.
Question Comments
Added By: Linzie at: 5/1/2014 9:07:22 AM
When I tried to run this example, it fails. Also when I pull up the code in VS2012 (devx controls version 13.2.9) the MainPage.xaml has this part underlined with the following error:
This example illustrates how to filter LookUpEdit item source values in one column based on the value of another column. This functionality can be implemented only when a filtered LookUpEdit is introduced using a cell template. In this case, every cell has an independent LookUpEdit editor, and we can manipulate its item source. The item source is filtered in the TableView.ShownEditor event handler. This event is raised when a cell gets focus, and its editor becomes active, so it is the best place to filter the item source.
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?
The following example demonstrates how to save a report document to a stream via the PrintingSystem.SaveDocument method, and then, how to load it via the PrintingSystem.LoadDocument method.
Question Comments
Added By: Thomas R Melinsky at: 7/30/2013 5:09:28 AM
This example crashes for me with the error X "The specified file cannot be loaded, because it either does not contain valid XML data or exceeds the allowed size." This happens just after hitting the "Load" button, and on the line ps.LoadDocument(stream). I am using 13.1.5.
The following example demonstrates how to bind a dashboard to a List object.
In this example, information about the sold units quantity is provided at runtime. The dashboard data source is created via the Dashboard.AddDataSource method on the first load.
To update the displayed data, the DashboardViewer.ReloadData method is called. This raises the DashboardViewer.DataLoading event and allows supplying the dashboard with updated data.
Question Comments
Added By: GUILHERME ROCHA at: 5/2/2014 2:50:26 PM
would be possible to load the dashboard of a list of objects in a web project? In web project there is no "dashboardViewer1.Dashboard = dashboard" property. I tried to replace "ASPxDashboardViewer1.DashboardSource = dashboard" not working. How could I do in this case?
This example is the second part of the SpreadsheetControl API set of examples that demonstrates how to use the SpreadsheetControl API to programmatically manage spreadsheet documents, without the need for Microsoft Excel to be installed.
This sample introduces API properties and methods used to perform the following operations:
- Insert, delete and modify pictures - Add a hyperlink to a picture - Add custom functions to the spreadsheet
Starting from v2013 vol.2:
- Create a table - Apply a custom style to the table
This sample demonstrates how to utilize client-side API to dynamically display a prompt text within a text box depending upon the editor's focused state.
Question Comments
Added By: Jacob Blumberg at: 8/26/2013 2:32:41 PM
Change the javascript to this to make the prompt text Gray
function OnTextBoxGotFocus(textBox) { if (textBox.GetText() == __initialText) { textBox.SetText(""); textBox.inputElement.style.color = 'black'; } } function OnTextBoxLostFocus(textBox) { if (textBox.GetText() == "") { textBox.SetText(__initialText); textBox.inputElement.style.color = 'gray'; }
}
Added By: Douglas Poston 1 at: 5/5/2014 9:55:21 AM
What if you have more than one text box on a page or form, how do you pass separate words for each text box to the function? It needs another parameter or something.
Added By: Alessandro (DevExpress Support) at: 5/6/2014 12:10:03 AM Hi,
In this example, we will create a WCF IDataStore service that will be used by our client (Console Application) as a data layer. Instead of a direct connection to the database, our client will connect to a remote service and configure the WCF end point programmatically. This is usually helpful when: - WCF specific customizations are required to provide custom bindings, endpoints, behavior, e.g. for a secured connection; - Your WCF service is not hosted in IIS and thus no .svc files are used (e.g., when the WCF Class Library project is used).
2. Create an EndPointHelper class which implements the GetDataStore static method as shown in the EndPointHelper.xx file. This method will be used to configure the WCF end point. The key is in manual creation and custom configuration of the DataStoreClient and CachedDataStoreClient objects (you can see their default configurations by checking the source code of the CreateWCFWebServiceStore and CreateWCFTcpServiceStore methods of the DevExpress.Xpo.XpoDefault class).
3. Use the GetDataStore static method in the Main method as shown in the Program.xx file to configure end point and create a IDataStore.
Important notes In XAF applications it is necessary to create a class that implements the IXpoDataStoreProvider interface and return the configured IDataStore. For additional information please refer to the How to use a custom ObjectSpaceProvider in XAF example that illustrates implementation of the IXpoDataStoreProvider interface.
This example illustrates how to group your report and export each group into a separate PDF file.
Question Comments
Added By: Scott Gross at: 5/5/2014 5:48:57 PM
IS there a way to do this from the Report Server on a schedule?
Added By: Dmitry Tok (DevExpress Support) at: 5/6/2014 5:38:04 AM
Hi Scott, The XtraReport is built on the server side in case of using the Report Server. So, I'm afraid that it is impossible to apply the demonstrated approach. Feel free to contact us in a new support thread or in the existing one if you have any questions. Thanks
In this example, we will create a WCF IDataStore service that will be used by our client (Console Application) as a data layer. Instead of the direct connection to the database, our client will connect to a remote service, which is way more secure and thus important in many enterprise scenarios as database connection settings are not exposed to the client.
Steps to implement
1. Create a new WCF Service Application project and add references to the DevExpress.Data and DevExpress.Xpo assemblies and remove files with auto-generated interfaces for the service.
2. Modify the service class as shown in the Service1 file. This service initializes a connection provider and stores it in the static DataStore property, which is then used by the base DataStoreService class.
3. Change some binding properties as shown in the example's web.config file. At this stage, the service part is ready to work and we need to implement a client to consume data from our data store service (for demonstration purposes, we will create a Console Application).
4. Add the Console Application into the existing solution.
5. Add a new code file for a Customer class using the DevExpress v1X.X ORM Persistent Object item template. See a code of Customer class in the ConsoleApplication\Customer code file.
6. Pass the address of our service into the GetDataLayer method of the XpoDefault class. For this, modify the Main method of the Console Application as shown in the ConsoleApplication\Program code file. Please note that the port number in the connection string may be different. You can check it in the properties of the service project in the Solution Explorer:
This example demonstrates how to create custom XAF modules with custom business objects and logic that would work with separate databases. These modules do not depend on each other and thus can be reused in other applications as a whole.
Steps to implement
0. Create a new XAF solution using one of predefined project templates;
1. Add two XAF modules into this solution using the DevExpress vXX.X XAF Module project template;
2. Add required persistent classes into these modules as shown in the ClassLibraryN/PersistentClassN.xx files of this example solution;
3. Add service ModuleInfo classes into these modules as shown in the ClassLibraryN/ModuleInfoN.xx files of this example solution;
4. Override the Setup(XafApplication application) methods of your ModuleBase descendants (see the YourModuleName/Module.xx files) as shown in the ClassLibraryX/XafModuleN.xx files of this example solution;
5. Build the solution, invoke the Module Designer for the platform-agnostic module (YourSolutionName.Module/Module.xx), and drag the created custom modules from the Toolbox:
Image may be NSFW. Clik here to view.
Alternatively, you can add the same modules via the Application Designer invoked for the executable projects (as demonstrated in this example).
6. Declare connection strings in the configuration files of your application as shown in the TwoXpoModelsForDifferentDatabases.Web\Web.config and TwoXpoModelsForDifferentDatabases.Win\App.config files (see ConnectionStringDatabaseX under the <connectionStrings/> element). These connection strings are used in the modules via the ConfigurationManager.ConnectionStrings API, but you can always modify the way your modules obtains this data.
Important notes
1. Each module has a single static XPObjectSpaceProvider instance, which is initialized only once during the application life cycle.
2. Each ModuleUpdater class checks the ObjectSpace property to determine whether it is valid to create initial data of a certain type from this module.
This example demonstrates how to apply a custom style to cells displayed within the 'Product Name' column based on a custom condition. A product's name is highlighted if the number of units is less than 20.
Question Comments
Added By: Bharadwaz Avvari at: 5/7/2014 2:38:37 AM
there is No color change in the this example. I think something is missing please check it once again. and Re post it