Quantcast
Channel: Developer Express Inc.
Viewing all 2401 articles
Browse latest View live

New CodeRush Plugin – Introduce Local (All Arguments)

$
0
0

The Motivation

I found this question on Stackoverflow

Essentially it breaks down to…

How can I refactor this….

IntroduceLocalAllArgumentsStart

…into this…

IntroduceLocalAllArgumentsEnd

… in a single step.

The Plugin

This plugin allows you to extract all arguments of a method to new locals which are then placed above the method call.

  • Place your caret on the call to the method whose arguments you’d like to extract.
  • Hit the CodeRush\Refactor key (Ctrl+` by default)
  • Choose “Introduce Local (All Arguments)
  • You’re done.

And the Result

IntroduceLocalAllArguments

Where can I get this wonderful plugin?

As usual, the source code and binary for this plugin are available on github

Like many others, this plugin is listed on the CodeRush Plugins Site.


New CodeRush Plugin Template – NewAction

$
0
0

Note: The template referred to by this post does not ship with CodeRush. To install it, see instructions towards the end of the post

This post describes the first new plugin template in a series. The series itself is introduced in my previous post - So you want to write a CodeRush plugin

PurposeShortcutsCommands

The NewAction template provides the single quickest way to create a new action for your plugin. Actions are named bits of code which an user can trigger via a shortcut (mouse, keyboard or menu).

Each new action creates an entry which will be placed in the commands dropdown on the shortcuts page.

Usage

First you’ll need a plugin project. An existing project is fine, or you can create a new one via:

    1. File \ New \ Project
    2. DxCore \ (VSIX) Standard Plug-in

NewCSharpPlugin

Once you are in your new project, you’ll see code like this:

NewPluginCode

As indicated in the screenshot, there you should:

  • Expand the template in the body of your main plugin class.
  • Call the new registerXXXX method from within the InitializePlugin method.

In more detail the steps are:

  1. Expand the template
    1. Position the caret in the body of the plugin class
    2. Type NewAction and hit <space>
      (Note:Those using FrictionFree mode will need to use <tab> instead of <space>)

      NewActionExpandedCS_thumb2
  2. Fill out the generated fields: The first is used to name the methods associated with your action. the second is used to provide the internal name of your action. The one which CodeRush will use and which must be bound to a shortcut in order to be triggered.
  3. Add a call to the generated Register method to your plugin’s InitializePlugin method.

    InitializeMyAction
  4. Add your plugin specific code to the generated Execute method. In the example below I have added a simple call to show a simple "”Hello World” MessageBox.

    ActionExecuteHelloWorld

All of these steps involve coding. None of them take you through designers, and there’s no searching for the right properties or events.

The Action does, of course, have more properties and events to investigate, but this template provides the basic setup which almost every action will require.

Download and Install

This template is available in the CodeRush Plugin Templates repository on Github

To install this template you need (the raw version of) CS_NewAction.xml from the repository.

Update: If you’re using the Template Importer plugin, you can pass it this url to import the NewAction template straight off the web.

New CodeRush Plugin - Template Importer

$
0
0

I was rereading my previous post New CodeRush Plugin Template – NewAction

In it I asked you to ….

  • Visit a page on github.
  • Locate an XML file.
  • Download that file.
  • …and finally Import the file.

However it occurs to me that this is rather lengthy and awkward.

What if we could automate that a little more?
What if we could write a plugin which was able to download templates and install them itself?
What if….

Aw nuts! Never mind ‘What if’……….Let’s just do it!

CR_TemplateImporter

This is Template Importer.

TemplateManagerImporting
Note: It’s pretty clear that I’m no UI expert, but that’s another good reason to open source and accept pull requests.

In brief:

It can do 2 amazing things.

  • It can import exactly 1 exported set of templates by providing the address of an exported template file to the 1st box and pressing Import.
  • It can import multiple sets of exported templates by providing the address of a package to the 2nd box and pressing Import.

More Detail

Import Templates (from the Web)

A exported set of templates (see Exporting and Importing CodeRush Templates) is just an XML file. They’re easy to create, easy to store and easy to publish for others to use. All that’s really needed is an easy way to strip them off the web, and import them into your system.

The top half of the screen does exactly this. You can specify the url of a raw template file, and then click the Import button.
(For your convenience, the little “>” button on the left will copy the example into the live box)

The example file is published on github, but there’s no limit to where you can put these files.

  • Host them on your intranet.
  • Put them in your dropbox account.
  • Attach them to your blog.
  • ftp them into place.
  • ‘git push’ them into place.

Anywhere they can be reached by http is good enough.

I’m planning on uploading a lot more of my templates to various appropriate github locations.

But wait …. It gets better!

Import Packages (from the Web)

Q: Hang on… What is a package?

A: A package is a simple xml file (Yes I like XML files. Sorry.) which contains the urls of one or more exported template files.

For example here is the contents of the example package that is listed within the TemplateImporter by default.

TemplatePackageDefinition

The xml is fairly simple.

The template node has a url attribute (pointing the way to a template file) and a language attribute (specifying the language of the templates within the file).

Of course you can add as many ‘template’ nodes as you want, which means that you can create single package file that lists all your favourite 3rd party templates and then import them onto any machine you like in one hit. Great for being able to pull your standard templates onto your co-worker’s machine.

Limitations

The Current Template Importer is limited in a few ways.

  • Template Import only understands VB.Net and CSharp templates.
    There is no information held in a set of exported templates regarding the source language from which it came. The importer makes an intelligent guess based on the prefix of the filename you point it at. It understands Basic, VB, CSharp and CS.
    Note: Package Import does understand the other languages. As indicated, the package will contain a language attribute for each url resource listed. this is used by the importer in order to place the templates in the correct location.
  • There is no preview.
    There is no option to preview what you’re getting in advance of getting it. Unless of course you’re prepared to wade (and I mean wade) into the xml of the files you’re instructing the Importer to import.
  • There is no selective import.
    You get every template in the file(s) or nothing at all.
  • The import is additive only.
    It will add these templates at their own specified locations in addition to anything else that might be there already. This includes copies of the exact same templates that you imported 5 seconds previously. In order to get only the latest version of a set of templates previously imported, I recommend deleting any previous revisions of those templates prior to each import.

Guidelines

There are no real safeguards in place yet. Be careful.

  • Don’t import templates from a source unless you explicitly trust that source.
    Really this one should speak for itself.
  • Don’t export templates from outside your custom folder.
    If someone were to import those they’d wind up with duplicate core templates. I’m honestly not sure what the effect would be, but it would certainly cause a mess
    If templates are always exported from within custom, they they’ll import there as well. This then limits the potential mess to the users custom folder.
  • Only import templates into your Custom folder.
    If you only ever import templates into you custom folder, then you can always restore your system to normal simply by hosing that folder.

So where can I get it?

As usual, the source code and binary for this plugin are available on github

Like many others, this plugin is listed on the CodeRush Plugins Site.

Usage

You can either:

  • Bind a key to the ‘ImportTemplates’ command, and trigger it with the keystroke of your choice.

OR

  • Use the ‘Import Templates’ menu item I’ve placed on the CodeRush menu.

In future when I provide one or more templates, you should be able to use this plugin to point directly at the file’s url and suck the templates straight off the web without all that tedious mucking about with Right click … Save As etc

Code PaLOUsa 2014

$
0
0

Last week, Feb 24-26, we were Gold sponsors at Code PaLOUsa at the historic Galt House in lovely Louisville, KY.  I love KY, but I’m biased because I grew up there!   Azret and I were manning the booth, and were quite busy on day 1 talking to current and potential customers.  We also had new shirts to give away with our UI Superhero logo!  Lots of positive comments on this little guy.

photo

And here’s one of our DevExpress booth (and me!) —we had a blast talking to customers about all of our offerings- mainly .NET folks, but there was quite a lot of interest in our HTML5/CSS3/JS products as well: PhoneJS and ChartJS.

BoothCodepaLOUsa

Looking forward to seeing some of you at our upcoming events this spring and summer!

And let us know what you think of our new t-shirts. Smile

Amanda

New CodeRush Plugin Templates – NewCodeProvider and NewRefactoring

$
0
0

Note: The templates referred to by this post do not ship with CodeRush. To install them, see instructions towards the end of the post.

This post describes two more templates in my Plugin Templates series. The series itself is introduced in my previous post - So you want to write a CodeRush plugin

PurposeCodeRushSmartTagMenu

The NewRefactoring and NewCodeProvider templates are the single quickest way to get started creating Refactoring and CodeProvider(Collectively called ContentProviders) plugins

These types of plugins add items to the Red (Refactoring) and Blue(Code) sections of the CodeRush SmartTag menu.

Usage

The templates work very similarly to My previous NewAction template in terms of placement. ie You should expand them in the body of your plugin class and then call the generated register methods from within your plugin’s the InitializePlugin method

This is how the NewRefactoring template expands:

TemplateNewRefactoring

…And here is what you get when you expand the NewCodeProvider template

TemplateNewCodeProvider

Note: As before, you’ll need to call the appropriate registration method from your InitializePlugin method

You can see they are structurally very similar. they both create Register, CheckAvailability and Apply methods. In each case there is a small amount of customization to be done in order to get your ContentProviders up and running.

You’ll have to give your ContentProvider 3 names.

  • Your own reference.
    The first name is your own reference. The phrase you type here is used to name the objects and associated methods of your ContentProvider.
  • Internal name
    This value is used internally by CodeRush. It should be unique, since it will be used to add  your ContentProviders to an internal dictionary. Later you can use this name to get a reference your ContentProvider from another plugin.
  • Display Name
    This value is used for the text displayed when your provider is added to the CodeRush SmartTag menus

Next you’ll have to provide the code for:

  • Your CheckAvailability method
  • Your Execute method.

CheckAvailability

Availability is about determining if it is currently appropriate for your ContentProvider to be present on the CodeRush SmartTag menu.

Your CheckAvailability method is where you do this. In the unlikely event that your Refactoring\CodeProvider is always supposed to be available, simply leave the code as it is.

ContentProvider_CheckAvailability

In most cases, your ContentProvider will only make sense under certain circumstances. If these circumstances are not met, then it makes more sense to simple not show your ContentProvider in the SmartTag menu.

Consider the “Split String” refactoring. This refactoring is designed to allow you to change

HelloWorldString

…Into…

HelloWorldStringSplit

It’s clear, there is no point in providing this Refactoring, unless the user’s caret is within a string.

Thus the SplitString_CheckAvailability method might look something like this:

SplitString_CheckAvailability

See how it only sets ea.Available to true if the ActiveString is not null. ie The caret is on a string literal.

Of course you should feel free to make your determination in any way you see fit.

You could:

  • Analyse the code where the caret is.
  • Analyse the project or the files within it.
  • You could base your own availability on the availability of another CodeProvider.
  • Look for code smells or other patterns.

If you really want to, you could call out to the web, and check a webcam to see if there’s a blue moon Smile

Just keep in mind that the check you perform here, will be performed quite often as the user moves around the code. This code needs to be as fast as possible.

Execute

As you might imagine, the ContentProvider_Execute method is where you perform the main function of your ContentProvider.

You might:

The sky really is the limit.

Ok Cool, so how do I get these templates?

The NewRefactoring and NewCodeProvider templates are available in the CodeRush Plugin Templates repository on GitHub

You can import them the traditional way

OR you can use the Template Importer and point it at

  • This URL for the NewRefactoring template
  • This URL for the NewCodeProvider template

If you have any suggestions to improve any of the templates in this series, feel free to contact me via email or on twitter.

If you so inclined you could even fork the project, make some changes and send me a pull request.

BASTA 2014 and Mixer

$
0
0

I was extremely fortunate to attend BASTA 2014 in Darmstadt. Germany is a wonderful place full of extremely intelligent developers building amazing things. One of my objectives is to learn about what folks are building with our products and to find ways we can improve.

Me

Oliver (our Training Director) was on hand to provide great technical content (in German no less).

Oliver Sturm

John Martin was also in attendance (he works closely with developers in Germany and is a seriously awesome colleague):

John Martin

Oliver and I had a series of talks at the conference as well. To be honest, I had one talk and he had 200 or so (if I remember correctly).

One of the highlights of the event was our Customer Mixer. We invited customers from all over Germany to spend some time with us talking about what they are building and how we can improve our products in general. It was probably one of the best parts of the trip: speaking and interacting one-on-one with each and every customer.

Mixer Part 1

I seriously think I managed to speak to everyone there:

Mixer Part 2

There are tons more pictures if you would like to have a look.

If you are interested in us coming out to an event let me know! I am anxious to really get into how our products are actually being used (as opposed to the awesome demoware I manage to create on a daily basis).

As always, if there are any comments and/or questions, feel free to get a hold of me!

Seth Juarez
Email: sethj@devexpress.com
Twitter: @SethJuarez

Three simple ways to handle DevExpress ASP.NET Callback Errors

$
0
0

Handle Callback Errors DevExpress ASP.NET

Here's three simple ways to handle DevExpress ASP.NET Callback Errors:

  1. Do nothing.
  2. ....
  3. PROFIT!

Do Nothing?

Yes. For the last couple of years, DevExpress ASP.NET products have been using the excellent ASPxHttpHandlerModule to:

  1. Catch callback errors within DevExpress ASP.NET controls
  2. Bubble them up and display them to you

Callback Errors in 2014

I'm writing this blog post because of a video that I made on how to handle Ajax Callback Errors. That was six years ago in 2008! In fact, you can still read it here: Ajax Callback Error in ASP.NET – Video on How-To Handle

It surprises me that developers are still requesting this video. While's the video is still available, it's not needed anymore. Here's why:

Web.Config

When you use DevExpress ASP.NET, you'll notice that your web.config file is updated. That's because the versatile DevExpress ASPxHttpHandlerModule not only handles errors but it's also used for many other things like compressing and combining scripts, delivering images, etc.

DevExpress Help: Web.Config Options Overview

So, what's a callback error?

First, let me define a callback:

On the other hand, a callback is also a special kind of postback, but it is just a quick round-trip to the server to get a small set of data (normally), and thus the page is not refreshed, unlike with the postback...think of it as 'calling the server, and receiving some data back' - Excellent stackoverflow answer from Andreas Grech

Therefore, a callback performs a partial page update. So when you page, sort, or do some other operation on the DevExpress ASP.NET GridView, a callback occurs on the server and only the grid is redrawn.

A callback error occurs when there's an error on the server side during the callback. And because the page is only refreshing a portion of itself, you may not always see the error. And this is where the ASPxHttpHandlerModule will catch the error for you and display it as well.

The more you know...

Now that you're empowered with this peace of mind, treat yourself to a chocolate cupcake.

When only the best will do.

From interactive Desktop applications, to immersive Web and Mobile solutions, development tools built to meet your needs today and ensure your continued success tomorrow.

Get full access to a complete suite of professional components that let you instantly drop in new features, designer styles and fast performance for your applications.

Download a free and fully-functional version now: http://www.devexpress.com/Downloads/NET/

The IDE's of March

$
0
0

There is certainly nothing to be afraid of this March.  There are so many different ways to get things done inside Visual Studio, I decided to take a walk through some of my favourite IDE settings. Join me on March 13 as I take a look at some of the cool wizards, scaffolding and CodeRush features available in your IDE.  Space is limited, so register today at https://www3.gotomeeting.com/register/918271278

More information can be found at the webinars page here: https://www.devexpress.com/Support/Webinars/




What's New in 13.2.8 for the WinForms Widget View

$
0
0

In 13.2, we introduced a Widget View - a highly customizable UI option for our WinForms customers. Since then and because of the great feedback we've received from our loyal users, the product has evolved and in 13.2.8, it includes a new table layout view and a wobble animation to simplify runtime customization for your end-users.

First and perhaps most important, if you've not seen the WinForms Widget View in action, you may want to start our WinForms demos and click the Desktop UI Manager tile to launch the appropriate application. The Widget View demos are listed within the NavBar. They are called: Sales Performance Widget View, Dashboard Widget View and Stock Price Widget View.

If you've downloaded our latest build, take a moment to run the Sales Performance Widget View demo. In it, you'll discover that with the new table layout enabled, the View is automatically divided into rows and columns with absolute/relative lengths. These rows and columns generate a table allowing you to insert individual Widget Documents within its cells. The Widget Documents themselves can be stretched across neighboring columns or rows as necessary. Customizing the Widget View with the new table layout is a breeze...Dragging the Document activates a wobble animation, highlighting the items that can be swapped with the one being dragged. Additionally, both columns and rows can auto-resize when the parent form resizes. This eliminates any gaps at the View's edge for screen resolution independent user experiences.

WinForms Widget View Control - Wobble Animation

New CodeRush Plugin Template - NewMetric

$
0
0

Note: The template referred to by this post does not ship with CodeRush. To install it, see instructions towards the end of the post.CodeRushMetric

What is a Metric

A metric is a measurement of some quality of your code. In this case it is a per-method measurement. CodeRush displays the metric for each member, on left of the member in question.

CodeRush ships with 3 such metrics:

  • Lines of Code
    Exactly what it sounds like. This metric measures the number of lines occupied by the method. This is a pretty basic metric which includes the signature and braces of the method.
  • Cyclomatic Complexity
    A measurement of the number of paths through your code. The higher this value, the more tests will be needed to cover the method’s behaviours correctly.
  • Maintenance Complexity
    This metric weights each element of the method according to how it affects the maintainability of said method. You can read more about this metric here

You can choose which metric CodeRush displays, by clicking the current value and choosing another metric from the list. CodeRushMetricChoice

The NewMetric Template

As you’ll have guessed based on previous posts in this series, the purpose of the NewMetric template is the quickest way to create your own metric?

Usage

As with other plugin templates, this one is intended to be expanded (NewMetric<space>) in the body of your plugin class.

It will produce code that looks like this:

TemplateNewMetricExpanded

As with other plugin templates, you’ll have to give your Metric 3 names.

As a quick reminder, these are:

  • Your own reference.
    The first name is your own reference. The phrase you type here, is used to name the objects and associated methods of your Metric.
  • Internal name
    This value is used internally by CodeRush. It should be unique, since it will be used to add your Metric to an internal dictionary. Later you can use this name to get a reference your Metric from another plugin.
  • Display Name
    This value is used for the text displayed when your provider is added to the drop down list of metrics provided inline.

Next up, you’ll have to call the registerXXXX method (just generated and named) from within your plugin’s InitializePlugin method.

Finally you need to implement your plugin’s new metric. This is achieved by adding code to the GetMetricValue handler (also stubbed out by the template).

Typically you’ll examine the source of your project and perform some sort of calculation based on the LanguageElement passed to you in e.LanguageElement. Then you’ll assign the result of this calculation to e.Value.

So if you were looking to replicate the lines of code metric, you might use code similar to:

LinesOfCodeMetric

..and that’s it.

In Summary…

  • Expand NewMetric template
  • Call RegisterXXXX from InitializePlugin
  • Implement your metric (possibly in a single line of code).

…and you’re done.

Where do I get this template?

As usual this template is available from the CodeRush Plugin Templates repository on GitHub

If you have any suggestions to improve any of the templates in this series, feel free to contact me via email or on twitter.

If you so inclined you could even fork the project, make some changes and send me a pull request.

What’s New in 13.2.8 for the DevExpress Spreadsheet Control

$
0
0

We’re still some time away from publishing our first major release of the year, 14.1, but there have been some great new features added to our controls. Rather than forcing you to wait a few more months, we thought you’d benefit more by getting them early – say halfway – in one of our minor updates. Version 13.2.8 is this minor update: it will be a bigger minor release than usual, so let’s call it a Major-Minor release.

I’m here to tell you some of the nifty new enhancements to our “thick client” spreadsheet controls (that is, WinForms and WPF).

1. Improvements to the API for working with cell editors. You can now programmatically close the cell editor and specify whether the value entered by the user should by committed to an active cell, all selected cells, an array formula, or should be rolled back.

2. Extensions to Custom Draw. (WinForms Spreadsheet only) You can now custom paint not only the cell content and background, but also any column and row header content and background.

Example of custom drawing column and row headers

You should review the E5044 example, as it demonstrates how to use the new SpreadsheetControl’s CustomDraw* events.

3. Display custom warning dialogs. This feature was actually introduced in 13.2.7. Essentially you use the IMessageBox service.

Example of displaying a custom message box for the spreadsheet

Review the E5052 example for sample code that uses this technique.

4. Cell background patterns. Background patterns can now be displayed in worksheet cells.

Background patterns in cells

5. Diagonal borders. Diagonal borders can now be displayed in cells.

CellDiagonalBorders

6. Custom hyperlink click events. You can now handle hyperlink clicks (the new SpreadsheetControl.HyperlinkClick event) to invoke custom forms and perform custom actions.

7.Printing specific worksheets. You can now specify which specific worksheet in a spreadsheet gets printed, by handling the new SpreadsheetControl.BeforePrintSheet event. This fires before a spreadsheet is printed and it enables you to define the name and index of a worksheet to be used.

8. Replace custom functions with values. You can now replace custom function definitions with the calculated values when exporting a document. This helps prevent custom functions from being displayed as #NAME? when sharing with other spreadsheet applications.

9. The Cell.Tag property. This allows you to store some data that is closely associated with a worksheet cell. This property value is cached depending on the cell reference, and the cache is automatically re-calculated if a cell has been moved, copied, or removed.

10. Improvements to the cell selection API.  You can now programmatically select multiple non-adjacent cell ranges or shapes in a worksheet simultaneously.

11. Formula editing: selecting cell ranges. The SpreadsheetControl allows you to interactively select cell ranges while editing a formula in a cell.

Selecting cells and ranges when editing a formula

12. End-user restrictions on actions with images/shapes. You can now restrict certain operations on images and shapes in your document. You can prevent the end-user from performing moves, resizes, changes in Z-order, or rotations. 

13. Storing documents in a database. The SaveDocument and LoadDocument methods are available to store a spreadsheet in an external database and load it back from a database. See the E5132 example.

14. MVVM support. Dependency properties that allow binding SpreadsheetControl options using an MVVM pattern have been implemented.

15. Turning the Fill Handle on/off. (WinForms only) The Fill Handle (the indicator in the bottom right of a selected cell or range) can now be disabled if needed.

Controlling the use of the Fill Handle

16. Control the type of print preview.  (WinForms Spreadsheet only) Using the new SpreadsheetControl.Options.Print.RibbonPreview option, you can control whether the Print Preview is shown with a modern Ribbon UI or a traditional bar UI when called with the ShowRibbonPrintPreview() method.

The spreadsheet's Ribbon Print Preview

17. Rendering with GDI or GDI+. (WinForms only) You can now specify if you want the spreadsheet rendered with GDI or GDI+.

18. Added Auto and MinMax threshold values for conditional formatting rules. (WinForms only) Use the MinMax value to set the minimum or maximum threshold of a two-color scale, three-color scale, or data bar conditional formatting rule to the lowest or highest value in the cell range to which the rule is applied. Use the Auto enumeration value to determine a scale for a data bar conditional formatting rule making 0 the minimum threshold and using the highest value in the cell range as the maximum. If the range to which the rule is applied contains negative values, the lowest value in the range becomes the minimum.

As always, we’d love to hear your feedback about these changes and whether you like getting new features as and when they are ready, rather than waiting for the next major release.

What's New in 13.2.8 for the .NET DevExpress Dashboard

$
0
0

We’ve managed to sneak a couple of features into our dashboard offering in our next minor release!

Filter Popup

Filter Popup

We recognize that a dashboard is sort of a living report with many filters often created and executed. Instead of cluttering the title space we’ve added a new popup describing the active filters currently set for the entire dashboard. In the case above this particular dashboard has a filter set on the ticket type as well as a selected state (off screen in this instance).

Printing

Print Preview Options

We’ve also added a couple of print preview tools to fine tune the type of output you would like to see when printing. Above you can see the new Dashboard Print options. Below you can see the new Header/Footer options.

Print Preview Header and Footer Options

These header/footer options allow not only the insertion of custom text (to the left, middle, or right), but also allow for “calculated” text. This type of “calculated” text includes the current, date, user, page number etc.

Exporting

Previously our export options were non-existent (we let you choose a file name). We have beefed up our PDF export options:

Dashboard PDF Export Options

We’ve also updated (added really) options for exporting the dashboard as an image:

Dashboard Image Export Options

One feature of interest is the Filter State. When checked this creates a view into the current state of the dashboard:

filter_state

Overall a big boost for exporting the dashboards you create.

Data Items Area Improvements

This is by far my favorite addition. Take a look:

Group and Item Movement in Data Items Section

Moving things around in the Data Items  section proved to be extremely difficult until this release. We have added the ability to move around items in the Data Items area by simply, well, moving them around. Notice that there are essentially two ways of moving things in the Data Items section: by group or by field. Moving by group essentially moves the entire collection of elements within the group to a different position. One can also move an element of a particular group out to its own area. Like I said, one of my favorite additions: it should certainly shorten the amount of time we spend experimenting with just the right layout.

Final Words

Overall I’m pretty excited with our dashboard product. We are continually making great strides in making this a truly remarkable tool for exploring and understanding data.

As always, if there are any comments and/or questions, feel free to get a hold of me!

Seth Juarez
Email: sethj@devexpress.com
Twitter: @SethJuarez

What's New in 13.2.8 for the ASP.NET Ribbon Control

$
0
0

Check out these 3 new features of the The DevExpress ASP.NET Ribbon control:

  1. ASPxRibbon - Populate a ComboBox when binding the control to a data source
  2. ASPxRibbon - Extend Ribbon data-related properties that support automatic data binding
  3. ASPxRibbon - Add the Visible property to elements (Tab, Group, Item)

DevExpress ASP.NET Ribbon Control

Minor Release - v13.2.8

The 3 features are included as part of the DevExpress v13.2.8 release.

Download the v13.2.8 (or newer) release now.

Ribbon & HTML Editor

With this v2013.2.8 release, you can also use the DevExpress ASP.NET Ribbon Control with the DevExpress ASP.NET HTML Editor control:

Use the Ribbon control with DevExpress ASP.NET HTML Editor - v13.2.8

When only the best will do.

From interactive Desktop applications, to immersive Web and Mobile solutions, development tools built to meet your needs today and ensure your continued success tomorrow.

Get full access to a complete suite of professional components that let you instantly drop in new features, designer styles and fast performance for your applications.

Download a free and fully-functional version now: http://www.devexpress.com/Downloads/NET/

What's New in 13.2.8 for the ASP.NET Ribbon and HTML Editor

$
0
0

Check this out, you can now use the DevExpress ASP.NET Ribbon control with the DevExpress ASP.NET Html Editor:

DevExpress ASP.NET HTML Editor With Ribbon

The Ribbon Control

The DevExpress ASP.NET Ribbon control was introduced just a few months ago in the v2013.2 release:

ASP.NET WebForms and MVC: Ribbon Control (What's new in 13.2)

After the release we asked ourselves the natural question, "Why not integrate the excellent Ribbon control with the ASP.NET Html Editor?" And the result of the integration means that you can now offer your end-users another slick way to interact with the Html Editor.

Better with Metropolis

In the animated GIF above, I'm using the new Metropolis theme. We've created special new icons in the 13.2 release for the Metropolis and Moderno themes. And these new themes are my favorite:

Download v13.2.8 Release

The ASP.NET Ribbon control's integration with the Html Editor is in version 13.2.8.

Download the v13.2.8 (or newer) release now.

When only the best will do.

From interactive Desktop applications, to immersive Web and Mobile solutions, development tools built to meet your needs today and ensure your continued success tomorrow.

Get full access to a complete suite of professional components that let you instantly drop in new features, designer styles and fast performance for your applications.

Download a free and fully-functional version now: http://www.devexpress.com/Downloads/NET/

DevExpress MVVM Framework. Data validation. Implementing IDataErrorInfo.

$
0
0

The IDataErrorInfo interface is the standard mechanism for data validation in WPF and Silverlight. IDataErrorInfo can provide validation rules for each property in isolation or, alternatively, on the entire object. This post presents three distinct IDataErrorInfo implementations.

As an illustrative example, I will use the simple registration form below:

initial_256color

A complete sample is available from http://www.devexpress.com/example=E5151.

Version 13.2.8 extends our POCO to support an automatic IDataErrorInfo implementation. See our post for additional information on POCO View Model support.

Attributes

Attributes are the most straightforward IDataErrorInfo validation approach. Attributes for specifying validation constraints including Required, Range and CustomValidation are available in the System.ComponentModel.DataAnnotations andDevExpress.Mvvm.Native namespaces.

The sign up form ViewModel with validation attributes is as follows:

[POCOViewModel(ImplementIDataErrorInfo = true)] 
publicclass SignupViewModel {
[Required(ErrorMessage = "Please enter the first name.")]
publicvirtualstring FirstName { get; set; }
[Required(ErrorMessage = "Please enter the last name.")]
publicvirtualstring LastName { get; set; }
[EmailAddress]
publicvirtualstring Email { get; set; }
[Required(ErrorMessage = "Please enter the password.")]
[MinLength(8, ErrorMessage = "The password must be at least 8 characters long.")]
[MaxLength(20, ErrorMessage = "The password must not exceed the length of 20.")]
[CustomValidation(typeof(SignupViewModel), "CheckPassword")]
publicvirtualstring Password { get; set; }
[Required(ErrorMessage = "Please confirm the password.")]
[MinLength(8, ErrorMessage = "The password must be at least 8 characters long.")]
[MaxLength(20, ErrorMessage = "The password must not exceed the length of 20.")]
[CustomValidation(typeof(SignupViewModel), "CheckPassword")]
publicvirtualstring ConfirmPassword { get; set; }
publicstatic ValidationResult CheckPassword(objectvalue, ValidationContext context) { ... }
}

NOTE: The MinLength, MaxLength and EmailAddress attributes became available in .NET 4.5.

The POCO will implement the IDataErrorInfo interface for you. Make note of the POCOViewModel attribute and its ImplementIDataErrorInfo parameter, which need to be explicitly specified.

Fluent API

Although attributes are convenient in simple scenarios, they quickly become awkward with custom validation logic. The validating method name (CheckPassword in our case) is passed to the attribute as a string, which makes refactoring less pleasant and more error prone.

The problem is even more pronounced when doing localization. Compare passing an error message through an attribute

[Required(ErrorMessageResourceName = "PleaseConfirmPasswordError",
ErrorMessageResourceType = typeof(Resources))]
publicvirtualstring ConfirmPassword { get; set; }

to the same done via the Fluent API

builder.Property(x => x.ConfirmPassword)
.Required(() => Resources.PleaseConfirmPasswordError);

The Fluent API allows specifying metadata properties and constraints while preserving compile-time checks. The previous ViewModel can be rewritten as the following:

[POCOViewModel(ImplementIDataErrorInfo = true)] 
publicclass SignupViewModel : ViewModelBase {
static PropertyMetadataBuilder<SignupViewModel, string> AddPasswordCheck(
PropertyMetadataBuilder<SignupViewModel, string> builder) {
return builder.MatchesInstanceRule(vm => vm.Password == vm.ConfirmPassword,
() => "The passwords don't match.")
.MinLength(8, () => "The password must be at least 8 characters long.")
.MaxLength(20, () => "The password must not exceed the length of 20.");
}
publicstaticvoid BuildMetadata(MetadataBuilder<SignupViewModel> builder) {
builder.Property(x => x.FirstName)
.Required(() => "Please enter the first name.");
builder.Property(x => x.LastName)
.Required(() => "Please enter the last name.");
builder.Property(x => x.Email)
.EmailAddressDataType(() => "Please enter a correct email address.");
AddPasswordCheck(builder.Property(x => x.Password))
.Required(() => "Please enter the password.");
AddPasswordCheck(builder.Property(x => x.ConfirmPassword))
.Required(() => "Please confirm the password.");
}
publicvirtualstring FirstName { get; set; }
publicvirtualstring LastName { get; set; }
publicvirtualstring Email { get; set; }
publicvirtualstring Password { get; set; }
publicvirtualstring ConfirmPassword { get; set; }
}

Now, when you change a property name the compiler will require updating the metadata.

Custom implementation

If you need greater control over validation or you can’t use POCO View Models for some reason, you can use the following code generated by the POCO as a basis for your own implementation.

publicclass SignupViewModel : IDataErrorInfo { 
...
string IDataErrorInfo.Error {
get { returnstring.Empty; }
}
string IDataErrorInfo.this[string columnName] {
get { return IDataErrorInfoHelper.GetErrorText(this, columnName); }
}
}

The default Error implementation here returns an empty string. Change it to provide a custom error message.

Consuming the ViewModel

To use the resulting ViewModel, we need a View to be aware of our IDataErrorInfo implementation. Out-of-the-box, DevExpress controls support data validation and visual notifications when a user encounters validation errors. Our registration form example illustrates validation in Data Editors, but the Data Grid or Property Grid would do equally well – all support IDataErrorInfo validation. The View is the following:

<dx:DXWindowx:Class="DataValidationSample.MainWindow"
...
DataContext="{dxmvvm:ViewModelSource Type=local:SignupViewModel}">
<dxlayout:LayoutControldxe:ValidationService.IsValidationContainer="True"x:Name="validationContainer">
...
<dxlayout:LayoutItemLabel="Email" ...>
<dxe:TextEditText="{Binding Email, ValidatesOnDataErrors=True,
UpdateSourceTrigger=PropertyChanged}"
/>
</dxlayout:LayoutItem>
...
<Button ... IsEnabled="{Binding Path=(dxe:ValidationService.HasValidationError),
ElementName=validationContainer, Converter={dx:NegationConverter}}"
/>
</dxlayout:LayoutControl>
</dx:DXWindow>
 

That is all that’s necessary. Feel free to comment if you have any questions or suggestions.

 
OTHER RELATED ARTICLES:
  1. Getting Started with DevExpress MVVM Framework. Commands and View Models.
  2. DevExpress MVVM Framework. Introduction to Services, DXMessageBoxService and DialogService.
  3. DevExpress MVVM Framework. Interaction of ViewModels. IDocumentManagerService.
  4. DevExpress MVVM Framework. Introduction to POCO ViewModels.
  5. DevExpress MVVM Framework. Interaction of ViewModels. Messenger.
  6. DevExpress MVVM Framework. Using Scaffolding Wizards for building Views.
  7. THIS POST: DevExpress MVVM Framework. Data validation. Implementing IDataErrorInfo.

Tech•Days Netherlands 2014: Attend, Save, and Meet DevExpress

$
0
0

On April 16th & 17th, 2014, I'll be in Den Haag, Netherlands for the Microsoft Tech•Days:

Microsoft Tech•Days 2014 Netherlands

Save 50 Euros

DevExpress is proud to be a sponsor for Microsoft's Tech•Days 2014. And because we have a great relationship with the show's organizers, they've given us some discount codes.

Email John (JohnM@devexpress.com) and you'll get a special code that will save you 50 Euros when you register for the conference.

Write Once, Deploy to Multiple Mobile Platforms

Come see my talk on Thursday, April 17th, 2014. I'll show the latest and greatest from DevExtreme.

And I would love to meet you and talk about what's happening on the web platform.


17 April 2014 - 10:50 - 12:05

Write Once, Deploy to Multiple Mobile Platforms


See you there!

Your Next Great .NET App Starts Here

Year after year, .NET developers such as yourself consistently vote DevExpress products #1.

Experience the DevExpress difference for yourself and download a free 30-day trial of all our products today: DevExpress.com/trial (free support is included during your evaluation).

DevExpress at the 9th annual Orlando Code Camp

$
0
0

DevExpress_at_Orlando_Code_Camp

In the Orlando area this weekend? DevExpress is sponsoring the 9th annual Orlando Code Camp this Saturday, March 22nd 2014. This is a free all-day event to be held at the Seminole State College, so make sure to stop by and say hi, see what DevExpress has to offer, enjoy the sessions, and call it a day with the After-Party.

For more information and directions, head on over to http://www.orlandocodecamp.com/

What’s New in 13.2.8 for the DevExpress WinForms Grid Control

$
0
0

If you and your team are considering ways in which to touch-enable your apps on the WinForms platform, we have lot's of interesting news we'll start sharing next month as we get nearer to our 14.1 release.

In the meantime, v13.2.8 includes an enhancement to our WinForms Grid Control to simplify the implementation of swipe gestures against individual grid rows. To best explain this feature, please review the following video.

I also wanted to share some screenshots of a "Modern UI" app we built using our touch-enabled WinForms Controls and one that Azret demonstrated at Code Palousa last month - we'll publish the project shortly so you can see how we built the app and determine if this UX makes sense for your business.


Modern UI Dashboard (showcasing our WinForms Range and Chart Control)

Windows 8 Inspired Dashboard on the WinForms Platform


Modern UI List View (showcasing our WinForms Grid, Chart and Range Control)

Windows 8 Inspired Appliction on the WinForms Platform


Modern UI Dialog (showcasing our WinForms Data Editors Library)

Windows 8 Insipird Dialog Box for the WinForms Platform


As always, please let us know what you think...we always appreciate the feedback.

What's New in 13.2.8 for the eXpressApp Framework (XAF)

$
0
0

ReportsV2

With XAF v13.2.8, you are now able to use ReportsV2 and the previously available Reports modules within the same application. This is good news for those who want to maintain use of existing reports along-side of new reports generated with XAF's ReportsV2 module.

How it works?

  1. Open the Application Designer for your existing XAF application (one that is using the previously released Reports module) and drop the new ReportsV2  module from the Visual Studio Toolbox:



  2. Create and design a regular XtraReport in Visual Studio, use the new ReportsV2 data sources and then register the report to display it within XAF's application UI.

  3. Run the application and see both legacy and new reports functioning side by side:



    Note that I also renamed the navigation items so you can distinguish between Old and New.


What is next?


We have received lots of positive feedback from our customers and plan to officially release ReportsV2 in 14.1 (due late May 2014).  We will be improving the existing documentation and adding more examples to highlight popular scenarios.



EFDataView - when flexibility and performance matters


The EFDataView is our new data source that allows arbitrary combinations of calculated and aggregated values to be retrieved from an
Entity Framework data model.

As a lightweight read-only list of data records, the EFDataView retrieves records from a database without loading complete entity objects. This list can be queried much more quickly than a real objects collection. If you are familiar with XPO, think of EFDataView as an analog of the XPView component.


How it works?


To create an instance of the EFDataView, pass an EFObjectSpace
instance to the EFDataView constructor or use the IObjectSpace.CreateDataView method. The data view column names and expressions used to compute column values are specified via the Expressions list. By default, this list is empty and you should populate it manually. Both simple properties and complex expressions can be passed to the EFDataView constructor or IObjectSpace.CreateDataView method via the expressions parameter. The valid separator is a semicolon:

EFDataView dataView = new EFDataView(objectSpace, typeof(Product), "ID;Name;Sales.Sum([Count] * Price)", null, null);


The data can also be filtered and sorted via the criteria and sorting parameters:

List<DataViewExpression> dataViewExpressions = new List<DataViewExpression>();
dataViewExpressions.Add(new DataViewExpression("Count", new AggregateOperand("Sales", Aggregate.Count)));
CriteriaOperator criteria = new BinaryOperator("Sales.Count", 0, BinaryOperatorType.Greater);
SortProperty[] sorting = new SortProperty[] {new SortProperty("Name", SortingDirection.Ascending)};
EFDataView dataView = new EFDataView(objectSpace, typeof(Sale), dataViewExpressions, criteria, sorting);

Data records are not retrieved from the database when the EFDataView object is created. Instead, the database is queried when you access a specific record by its index or call one of the following methods for the first time: IBindingList.Find,IEnumerable.GetEnumerator,Contains,CopyTo,Count,IndexOf.

Later, the cached data records are used by these methods. To refresh data, use the Reload method which clears the cache.

You can limit the number of retrieved data records by using the TopReturnedObjectsCount property.


Primary usage scenarios

1. Data source for a visual data-aware control.

Since the EFDataView implements the IBindingList and ITypedList interfaces, it can serve as a data source for a visual data-aware control, e.g. the grid, chart, pivot or any other. For instance, you can now use this component “as is” on a custom form  that retrieves data from the database via Entity Framework.

2. Fast and lightweight data calculations in custom business logic.

The EFDataView retrieves only required data and not entire persistent entities as well as provides great filtering and sorting capabilities. It is perfect to perform quick data calculations as your business logic dictates.
As an example, when you access a particular data record by its index, a lightweightIDataRecord object is returned:

IDataRecord dataRecord = dataView[0];

Now to get a column value within a particular data record, use the IDataRecord.Item property as follows:

int id = dataView[0]["ID"];

Here, the "ID" string is the name of the column within the Expressions list. If you use the semicolon-separated string to specify the columns set in the EFDataView constructor, the column name coincides with the expression text:

int total = dataView[0]["Sales.Sum(Count * Price)"];

What’s next?


We want to give an XAF user the flexibility to configure the ListView’s data source mode depending on the required functionality. This will be possible without writing any code, but rather via a setting in the Model Editor. For instance, Currently the ListView operates with entire persistent objects by default, but there will also be a built-in setting to enable the “Data View” mode to achieve a greater performance in certain scenarios (e.g., for analytics and reporting involving large volumes of data).  By introducing the new ViewDataSource component for our new ReportsV2 module in v13.2 we are already on our way to offering more flexibility for an XAF user. As our upcoming release of 14.1 draws near I will be able to share more details, so stay tuned.

DevExpress Universal for Dummies (part 2)

$
0
0

(Julian writes: Joe Hendricks was kind enough to promise to write an occasional blog series about his experience in using our Universal subscription for creating web apps for non-profits. Part 1 was an introduction, and now Joe follows the thread by jumping into the fray with our training options. Over to you, Joe!)

Hello again!

Joe training in the forest in the Pacific Northwest

Joe training in the forest in the Pacific Northwest. DevExpress training, that is.

Sorry for the delay in getting this blog entry out. My Oncologist decided to take two pounds of flesh out of me four weeks ago and I think he used barbed wire instead of sutures to close me up! But thankfully both my cancers are in remission, so I don't foresee any more medical interruptions in the project.

As a recap, I am a retired biz consultant with just enough C#/ASP.NET programming skill to be dangerous to the rest of the internet. I do volunteer work part-time for anti-poverty nonprofits, both hosting and designing/updating their websites on my colocated server. The goal for this project is to migrate these websites from a CodePlex open source CMS software to Developer Express's more feature-rich ASP.NET library and eventually manage it all via Developer Express's XAF/XPO toolset. By the end of this year I hope to have the nonprofits switched over to the new ASPx system and by the end of 2015 have it all running via XAF/XPO.

The progress I have made since the last blog entry is all about my experience with the vast training options DevExpress offers. Similar to my experience with Photoshop, one needs to focus carefully on only the project needs or too many fun features end up distracting and causing unwanted 'feature creep.' For example, MVC might be fun to learn, but my limited time for the project would make that learning curve a crazy choice. One should be guided ultimately by the customer, and what they want. So what do the non-profit managers I serve want? Mainly a WYSIWYG approach to text and images. That is 90% of the project. 

Demo Center Main Menu showing the link for ASP.NET demos

My training strategy then was to watch the product overviews to know what is available and where to focus, including both the ASPx Suite public ones on the DevExpress website (above) and the ASPx Suite overviews in their subscription training.

The link to the HTMLEditor documentation in the installed docs

Browsing the online documentation reassured me that the HTML Editor was definitely where to focus.

The specific help for the HTML Editor control

To find the specific training for this component, the Demo Center that is installed with the product has a great menu, including links to YouTube tutorials for the HTML Editor and also installed Demo Projects. By ignoring the MVC-specific HTML Editor videos, I only needed to watch about half of them.

The Training Videos on the DevExpress YouTube page

For very specific questions, I searched the DevExpress website for answers already given to others. If that failed, sending an email to the support team at DevExpress will get you an answer within a business days, sometimes within hours! Their email response usually includes some sample code if applicable.

After this approach to training myself on the HTML Editor, I am really comfortable and pleased with the many ways to adapt it. For example, I find that some non-profit managers use underlining a lot in their work applying for grants, writing policies, etc. But when they use underlining on a web page, the site visitor gets confused expected underlining to signify a link. The HTML Editor makes it a breeze to simply hide that button, but for an advanced user I can always make it visible. Another example is the ability to modify all the dialogs. This means I can rewrite messages in simpler, less technical form, since many of these non-profits are in other countries where English is the manager's second or third language (but they usually want the website in English to increase donations).

Joe's first try at using the HTML Editor in an web page

So what's next on my agenda?

I need to learn how to load and save changes made in the Editor, whether to xml files or a database. I also need to sort out deployment and authentication roles using the ASPx Suite. I'll report how those are going in the next blog entry.

Being an avid hiker and mountain climber, I sometimes enjoy doing the training and volunteer work outdoors. In the first photo above you can see what a great classroom our Pacific Northwest Forests make for webinars! (Either that or I’m Skyping Amanda!)

Viewing all 2401 articles
Browse latest View live