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

DevExpress VCL 13.2 beta now available

$
0
0

Our VCL team have been working diligently towards the 13.2 release of DevExpress VCL for mid-December, and as part of that work have just published the beta for active customers of the full VCL subscription. If you are such a subscriber, just login using your DevExpress credentials, go to the Download Center, and download the beta. Do note however that this is a beta: we’re pretty happy with it, but we’re still in polishing mode and there will be some issues that still need fixing.

You can discover the new features by visiting the What’s New page, but just to whet your appetite, here are some of the improvements to the suite. You’ll notice in particular that we are continuing to concentrate on bringing your VCL applications into the modern era of easily available touch-capable devices like laptops and tablets.

Touch

VCL Touch-Enabled Controls

Enhanced touch for the following controls: Filter Control, Page Control, Tab Control, Date Editor, Blob Editor. It can’t have come as any surprise, but the number of touch-enabled laptops and tablets running full Windows 8.1 is growing rapidly. Your users now expect touch capabilities in a modern app: with DevExpress VCL you can deliver.


Pixel Scrolling

VCL Tree List - Content Pixel Scrolling

Added pixel scrolling – which is de rigueur for touch-enabled applications – to the tree list (ExpressQuantumTreeList), the property inspector (ExpressVerticalGrid), and the layout view for the grid (ExpressQuantumGrid). For the latter control that means we have flawless pixel scrolling for Table Views, Banded Table Views, and Layout Views.


Themes

New Metropolis Theme

Four new application themes: Metropolis, Metropolis Dark, Office 2013 Light Gray, and Office 2013 Dark Gray. Nowhere else in the VCL community will you find such a breadth of choice for modern themes (in fact, we now have 45 skins to choose from).


Icon Library

DevExpress Icon Library - Image Picker

New DevExpress Icon Library and Manager. Our design team had a few days off at a retreat and produced this rich set of icons. They’re designed expressly for our customers to cover the majority of application actions. We’ve packaged that library of icons up with a design-time image picker so that it’s much easier to style your controls.


Tiles

VCL Tile Control - Desktop App

Windows 8.1 added more features to the Start Screen, including small square tiles, so we’ve responded by updating our tile control to cover these changes. Expect group captions and multi-tile rearrangement using drag and drop.


Layout

VCL Layout Control - Drag-and-Drop Indicators

The Layout Control now has enhanced targeting: we’ve added intuitive indicators that show all place where a drop operation can take place. Layout items can now enforce size limitations when their size is dynamically calculated.


I’m sure that you’ll be pleased with our continuing innovation in the VCL space. Our team is awaiting your feedback, so please try out the beta and let the support team know what you think.

(For completeness’ sake: the DevExpress VCL Subscription supports Delphi 7, 2007, 2010, XE, XE2, XE3, XE4, XE5, and C++Builder 2007, 2010, XE, XE2, XE3, XE4, XE5, in both 32-bit and 64-bit flavors. I reiterate my usual warning that support for the older compilers – especially the “non-Unicode” versions – may be marked obsolete with the next major version. I’d strongly recommend you consider upgrading.)


WinForms Widget View: Dashboard Style Cards (What's New in 13.2)

$
0
0

The new Widget View is part of the DevExpress Document Manager and was designed to give you a rich set of UI options so you can deliver experiences that are easy-to-use, easy-to-understand and ready for next generation touch enabled Windows Pro devices. Each card is a document and contains its own unique content. You can resize these widgets, re-arrange them on screen or maximize them via a double-click or double-tap.

The following is a screenshot from one our new demos - a collection of "cards" that display stock price information.

WinForms Dashboard Card Widget View

When a card is maximized, it displays detailed information on the selected stock. As you'd expect, you are in total control as to what's displayed in a card.

WinForms Dashboard Card View Maximized

The following example is a dashboard-style layout of individual widgets. Again, you have total control over the number of widgets used, their positioning and the controls used within each widget.

WinForms Dashboard Widget View

And of course, the Widget View fully supports the DevExpress App Theme Engine...Here is how it looks with the Metropolis Dark Theme applied.

WinForms Dashboard Card Widget View MetropolisTheme

Animations, animations and more animations...

If you are a Universal or DXperience Subscriber you already have access to beta 2 of this release and you can explore our shipping demos to see how we've integrated animations into this product. For those who own a WinForms Subscription, we are real close to the release and we can't wait to share it with you...the Widget View includes built-in animations when repositioning individual widgets, when minimizing/maximizing a widget and when changing form size.

I look forward to your feedback - thanks for reading. 

WinForms Taskbar Assistant (What's New in 13.2)

$
0
0

Another new addition to our WinForms product line is the Taskbar Assistant. It was built to simplify the customization of the Windows taskbar button, its live preview (displayed when you hover your mouse over the taskbar button) and to help you create jump lists (when you right click the taskbar button).

So here is the all too familiar taskbar button before we've applied our customizations to it...

WinForms Taskbar Assistant

Here it is with a 16x16 overlay image courtesy of the Taskbar Assistant.

WinForms Taskbar Assistant Overlay

Here is the same taskbar button with a progress bar.

WinForms Taskbar Assistant with Progress Bar

Note that you can control the manner in which the progress bar is displayed (normal, indeterminate, paused or error).

As mentioned earlier, the Taskbar Assistant allows you to customize the taskbar button's live preview and insert thumbnail buttons within it. 

Windows Taskbar Assistant Live Preview 

And finally, when you need to add jump lists to your taskbar button's menu, the Taskbar Assistant allows you to create both task and custom categories with individual items.

WinForms Taskbar Assistant Jump Lists

TourSnap–Sample Code

$
0
0

 

ts1

Recently Julian and I demonstrated the use of PhoneJS and a text editor to create a WebApp that was capable of capturing a photo, grabbing your current location and posting the photo and a message on Facebook.  You can watch the webinar on our Youtube channel here.

A lot of people have asked for the code, so I am including it here for you to download and play with. Note: You need to download PhoneJS also from http://PhoneJS.DevExpress.com

For more information on the OAuth2 Library see http://code.google.com/p/gwt-oauth2

Don’t forget if you want to experience PhoneJS inside Visual Studio, be sure to check out DevExtreme, the cross-platform, multi-device development framework, optimised for Visual Studio.

ts3

WPF Spreadsheet: New in 13.2

$
0
0

With only days to wait before you get your hands on it, I wanted to share some of the cool functionality that will be available in the WPF Spreadsheet control. Ever since we announced the first release of the WinForms version in 13.1, you guys have been asking, "what about WPF, what about WPF"... well friends, it's here.

So what's involved in creating a powerful easy to use Spreadsheet application that has more than 300 inbuilt formula, chart support, printing with full preview AND the ability to read/write .XLS files ???  Less than a dozen mouse clicks!

Seriously! From starting a new Visual Studio 2013 application I was able to generate a complete ready to ship Spreadsheet application with no more than my mouse.

Step 1. Create the project, drag on the Spreadsheet Control and reset layout.

image

Step 2. Auto generate the Ribbon and all toolbars.

image

Step 3. Run!

image

It really as simple as 1,2,3. But of course, there is so much more power available to you;

  • - 140 events you can interact with;
  • - 300+ inbuilt formula;
  • - Create your own custom functions;
  • - Interact with the document model directly;
  • - Load/Save .XLS, .XLSX, .CSV, .TXT files;
  • - Cell Formatting and Conditional Formatting.

There are so many uses for the Spreadsheet control, it’s fast, it’s versatile and best of all it’s now available for WPF.

ASP.NET: MVC 5 Support (What's new in 13.2)

$
0
0

Great news for ASP.NET MVC developers: DevExpress MVC Extensions support ASP.NET MVC 5!

The Microsoft ASP.NET team recently released the ASP.NET MVC 5 version of the framework. And the over 50 DevExpress MVC extensions are fully supported in ASP.NET MVC 5!

Versions: 12.2.14, 13.1.9, and 13.2

ASP.NET MVC 5 support is included with DevExpress versions 12.2.14, 13.1.9, and 13.2. However, the DevExpress MVC Wizard supports MVC 5 only in 13.1.9 and 13.2 versions of our library.

New MVC 5 Assembly

There's a new DevExpress.Web.Mvc5.v13.2 assembly. When using DevExpress MVC extensions with ASP.NET MVC 5, this new assembly is required. If you use the DevExpress wizard to generate a new MVC 5 project, it will automatically include this new reference.

Why the new MVC 5 assembly?

This is different than previous versions because ASP.NET MVC 5 introduced a breaking change: Currently, MVC 5 requires full trust. The official MVC 5 site specifies the required rule: “Remove any trust levels other than Full”.

DevExpress MVC Advantages

The DevExpress ASP.NET MVC Extensions offer you many advantages when working with ASP.NET MVC, including:

Over 50 extensions - Native MVC extensions that provide you functionality, beauty, and performance.

File New Wizard - The DevExpress file project templates save you a lot of time when creating a new MVC project that will use DevExpress MVC extensions. Learn more here:

Insert Extension Wizard - We've integrated a very useful wizard inside of Visual Studio that helps you to create new DevExpress MVC extensions, model bind them, and thus save you time. Check out this video to see it in action:

And there's a ton of other great advantages like cross-browser support, beautiful themes, localization, and more. Learn more here.

What's new in ASP.NET MVC 5?

MVC 5 brings some interesting new features:

  • One ASP.NET
  • ASP.NET Identity
  • Bootstrap
  • Authentication filters
  • Filter overrides
  • Attribute routing

Learn more about these features here: ASP.NET and Web Tools for Visual Studio 2013 Preview Release Notes

Helpful links

Watch the DevExpress ASP.NET MVC Getting Started videos to see how easy and powerful they are:

To learn more about Microsoft ASP.NET MVC 5:

Thanks.

Build Your Best - Without Limits or Compromise

Try the DevExpress ASP.NET MVC Extensions online now: http://mvc.devexpress.com

Read the latest news about DevExpress ASP.NET MVC Extensions: http://dxpr.es/ov1tQa

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

ASP.NET: SharePoint 2013 Support (What's new in 13.2)

$
0
0

Take a look at the new DevExpress SharePoint 2013 Demo site:

DevExpress ASP.NET and SharePoint 2013

http://sharepoint.devexpress.com/

The new demo is great too. It's cleaner and we've improved the navigation. On the left side, you'll find the DevExpress ASP.NET NavBar (ASPxNavBar) control integrated there. Give it a try now.

SharePoint 2013 supported

Beginning with the DevExpress 13.1 release, SharePoint 2013 is supported by all the DevExpress ASP.NET controls. Including the two SharePoint specific WebParts (List GridView and HtmlEditor):

DevExpress ASP.NET SharePoint 2013 Web Parts

New SharePoint 2013 features in 13.2

We added support for SharePoint 2013 in the first release of 2013 (13.1). But we wanted to wait to announce it because we've added a lot more features in the 13.2 release:

  1. The new SharePoint 2013 Demo portal! - We completely redesigned this demo and the new site gives you a great example of DevExpress ASP.NET integrated into SharePoint 2013.
  2. Design time support - DevExpress ASP.NET controls fully support design time in SharePoint projects. See also: Visual Web Part Creation
  3. ASPxHtmlEditor and SPxHtmlEditorWebPart:
    1. Improved visual interface in the list pages
    2. Controls are hidden on SharePoint wiki pages
  4. SPxListViewWebPart - DevExpress ASP.NET GridView SharePoint WebPart:
    1. Document Library support - (Document libraries are collections of files that you can share with team members on a Web based on Microsoft Windows SharePoint Services. For example, you can create a library of common documents for a project, and team members can use their Web browsers to find the files, read them, and make comments. Users with Microsoft Office can check out and edit the files as if they resided on a local or network drive)
    2. Support SPFieldLookup - (A lookup field takes its value from a field in another list. The list that provides data for the lookup field is called the lookup list. To get a reference to the lookup list, access the SPFieldLookup object's LookupList property. To determine which field in the lookup list is providing information, access the LookupField property)
    3. Support SPChoiceField and SPFieldMultiChoice - (SPFieldChoice - allows you to select one or more values)
    4. Support SPFieldUser (Similar to SPFieldLookup)
    5. External Field Support (This column lets you combine a column of data from an external data source with other columns in a native list or library. Because an external data column is added to a native list or library, all related list or library features work, including versioning, approvals, check-in and check-out, and file attachments )
    6. New context menu with different access rights
    7. New web part settings panel
    8. Localization

More Samples

DevExpress ASP.NET and SharePoint 2013 - Display Form

We've added even more great samples of DevExpress and SharePoint integration to show you what's possible:

There's even more samples of DevExpress and SharePoint integration:

Download Samples - Get any of the samples from the site directly and try it with your SharePoint portal (of course you'll need DevExpress ASP.NET products). And if you have any issues, please let our excellent support team know and they can help you.

SharePoint 2010, MOSS 2007

Starting with version 13.1 (v2013 vol 1), DevExpress ASP.NET controls only support SharePoint 2013.

Why?

DevExpress base/ASP.NET products migrated to .NET Framework v4+ with version 13.1 (v2013 vol 1). SharePoint versions prior to SharePoint 2013 are no longer supported (as of 13.1), because they require/operate under ASP.NET v2 (.NET v2) runtime.

If you're using any of the following versions then you'll need to use DevExpress ASP.NET controls that prior versions of 13.1 (v2013 vol 1):

  • WSS 3.0
  • MOSS 2007
  • SharePoint 2010

What's new in Microsoft SharePoint 2013?

To learn what's new in Microsoft SharePoint 2013, I recommend the following resources:

The new SharePoint.devexpress.com site is a fantastic example of how you can integrate any of the 90+ powerful DevExpress ASP.NET controls and SharePoint 2013 to provide a great experience for your end-users.

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/

ASP.NET WebForms & MVC: Token Box Control (What's new in 13.2)

$
0
0

Check out the new DevExpress ASP.NET Token Box control that's part of the DevExpress 13.2 release:

The DevExpress ASP.NET Token Box (ASPxTokenBox) editor provides your end-users the ability to auto-complete values from a predefined list. An end-user can select a value from the dropdown window list or type it manually:

What's a Token?

If you look up the definition of Token on google then you'll see many definitions:

However, in context to the TokenBox control, I prefer to think of a token as a symbol. Therefore, we display the selected item from dropdown with a colored box around it. This box now indicates to the user the choice they've selected from the dropdown. It's become the symbol of the words and numbers that represents the selected item. And the token box also contains an X mark at the right to allow the end-user to easily remove it the selected item. This visual cue is a different way to display selected items but I believe it gives the users a nice user interface when they can easily see their selected items.

You can see examples of the token box style input on popular websites like Gmail's To field:

And Facebook's messages:

And now, you can get this slick functionality and look in your ASP.NET web projects with the DevExpress ASP.NET TokenBox.

ASP.NET MVC & WebForms

This new data editor is available for both the ASP.NET WebForms and MVC platforms. These are both part of the DevExpress 13.2 release.

Features

The new Token Box control gives you many great features and themes, including:

  • DataBinding - You can databind the Token Box editor easily using a datasource on WebForms or Model Binding on ASP.NET MVC.

  • Themes - All the DevExpress themes are fully supported by this control.

  • AllowCustomTokens - allows you to control whether the end-user can create custom tokens or they must choose tokens from the dropdown list.

  • ShowDropDownOnFocus - controls the dropdown window visibility when the editor gets focus.

  • IncrementalFilteringMode - allows your filter the dropdown as items are typed into the window.

Getting Started Video

Watch the short ASP.NET Token Box Getting Started video below to see how easy and powerful this new control is.

ASP.NET WebForms:

ASP.NET MVC:

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. Introduction to POCO ViewModels.

$
0
0

v4Traditionally, MVVM development means writing significant ViewModel boilerplate for bindable properties and commands. Even after extending the DevExpress.Xpf.Mvvm.ViewModelBase class, you need at least five lines of code to declare a single bindable property and several more to define a command:

NOTE: Refer to the following topic to explore the ViewModelBase class: Getting Started with DevExpress MVVM Framework. Commands and View Models.

   1:publicclass LoginViewModel : ViewModelBase {
   2:string userName;
   3:publicstring UserName {
   4:         get { return userName; }
   5:         set { SetProperty(
   6:ref userName, value, () => UserName);
   7:         }
   8:     }
   9:public DelegateCommand<string> 
  10:         SaveAccountCommand { get; private set; }
  11:  
  12:public LoginViewModel() {
  13:         SaveAccountCommand = 
  14:new DelegateCommand<string>(
  15:             SaveAccount, CanSaveAccount);
  16:     }
  17:void SaveAccount(string fileName) {
  18://...
  19:     }
  20:bool CanSaveAccount(string fileName) {
  21:return !string.IsNullOrEmpty(fileName);
  22:     }
  23: }
 
With many bindable properties declared, it becomes a real nightmare if an error is raised in a property setter: as when passing the incorrect field to a setter or setting the incorrect property from a lambda expression. Worse, it is just not beautiful.

Now imagine, instead of the preceding code, writing this:

   1:publicclass LoginViewModel {
   2:publicvirtualstring UserName { get; set; }
   3:publicvoid SaveAccount(string fileName) {
   4://...
   5:     }
   6:publicbool CanSaveAccount(string fileName) {
   7:returntrue;
   8:     }
   9: }


The 13.2 release makes it possible, with support for POCO ViewModels. Generate a full-fledged ViewModel from your POCO class with ViewModelSource.

In code:

   1:publicclass LoginViewModel {
   2:protected LoginViewModel() { }
   3:publicstatic LoginViewModel Create() {
   4:return ViewModelSource.Create(() => new LoginViewModel());
   5:     }
   6:  
   7:publicvirtualstring UserName { get; set; }
   8:publicvoid SaveAccount(string fileName) {
   9://...
  10:     }
  11:publicbool CanSaveAccount(string fileName) {
  12:return !string.IsNullOrEmpty(fileName);
  13:     }
  14: }
 
In XAML:
 
   1:<UserControlx:Class="DXPOCO.Views.LoginView"
   2:xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
   3:xmlns:ViewModels="clr-namespace:DXPOCO.ViewModels"
   4:DataContext="{dxmvvm:ViewModelSource Type=ViewModels:LoginViewModel}"
   5:     ...>
   6:<Grid>
   7:<!--...-->
   8:</Grid>
   9:</UserControl>

ViewModelSource uses System.Reflection.Emit to dynamically create and return an instance of a descendant of the passed ViewModel. The approximate code of the descendant is:

   1:publicclass LoginViewModelBindable : LoginViewModel, INotifyPropertyChanged {
   2:publicoverridestring UserName {
   3:         get { returnbase.UserName; }
   4:         set {
   5:if(base.UserName == value) return;
   6:base.UserName = value;
   7:             RaisePropertyChanged("UserName");
   8:         }
   9:     }
  10:     DelegateCommand<string> saveAccountCommand;
  11:public DelegateCommand<string> SaveAccountCommand {
  12:         get {
  13:return saveAccountCommand ?? 
  14:                 (saveAccountCommand = 
  15:new DelegateCommand<string>(SaveAccount, CanSaveAccount));
  16:         }
  17:     }
  18:  
  19://INotifyPropertyChanged Implementation
  20: }

Now let’s examine how to control ViewModel generation.

Bindable Properties

The rules for generating bindable properties are simple: ViewModelSouce creates bindable properties for public virtual properties and automatic properties with a public getter and, at the least, a protected setter.

You can define functions to invoke when a property is changed. These functions need a special name: On<PropertyName>Changed, On<PropertyName>Changing:

   1:publicclass LoginViewModel {
   2:publicvirtualstring UserName { get; set; }
   3:protectedvoid OnUserNameChanged() {
   4://...
   5:     }
   6: }
   1:publicclass LoginViewModel {
   2:publicvirtualstring UserName { get; set; }
   3:protectedvoid OnUserNameChanged(string oldValue) {
   4://...
   5:     }
   6:protectedvoid OnUserNameChanging(string newValue) {
   7://...
   8:     }
   9: }

Use the BindableProperty attribute to set a function not matching the convention:

   1:publicclass LoginViewModel {
   2:     [BindableProperty(isBindable: false)]
   3:publicvirtualbool IsEnabled { get; set; }
   4:  
   5:     [BindableProperty(OnPropertyChangedMethodName = "Update")]
   6:publicvirtualstring UserName { get; set; }
   7:protectedvoid Update() {
   8://...
   9:     }
  10: }

The disadvantage of this approach is renaming a function or property causes its handler to stop working. This is why we also implemented support for fluent declaration. Use the Fluent API as follows:

   1: [MetadataType(typeof(Metadata))]
   2:publicclass LoginViewModel {
   3:class Metadata : IMetadataProvider<LoginViewModel> {
   4:void IMetadataProvider<LoginViewModel>.BuildMetadata
   5:             (MetadataBuilder<LoginViewModel> builder) {
   6:  
   7:             builder.Property(x => x.UserName).
   8:                 OnPropertyChangedCall(x => x.Update());
   9:             builder.Property(x => x.IsEnabled).
  10:                 DoNotMakeBindable();
  11:         }
  12:     }
  13:publicvirtualbool IsEnabled { get; set; }
  14:publicvirtualstring UserName { get; set; }
  15:protectedvoid Update() {
  16://...
  17:     }
  18: }

This approach avoids errors during refactoring.

NOTE: We will return to the Fluent API in an upcoming post to examine other tasks to solve with it.

Commands

A command is generated for each parameterless and single parameter public method.

   1:publicclass LoginViewModel {
   2://DelegateCommand<string> SaveAccountCommand =
   3://    new DelegateCommand<string>(SaveAccount, CanSaveAccount);
   4:publicvoid SaveAccount(string fileName) {
   5://...
   6:     }
   7:publicbool CanSaveAccount(string fileName) {
   8:return !string.IsNullOrEmpty(fileName);
   9:     }
  10:  
  11://DelegateCommand Close = new DelegateCommand(Close);
  12:publicvoid Close() {
  13://...
  14:     }
  15: }

Likewise, command generation can be controlled with the Command attribute or Fluent API:

   1:publicclass LoginViewModel {
   2:     [Command(isCommand: false)]
   3:publicvoid SaveCore() {
   4://...
   5:     }
   6:  
   7:     [Command(CanExecuteMethodName = "CanSaveAccount",
   8:         Name = "SaveCommand",
   9:         UseCommandManager = true)]
  10:publicvoid SaveAccount(string fileName) {
  11://...
  12:     }
  13:publicbool CanSaveAccount(string fileName) {
  14:return !string.IsNullOrEmpty(fileName);
  15:     }
  16: }
 
   1: [MetadataType(typeof(Metadata))]
   2:publicclass LoginViewModel {
   3:class Metadata : IMetadataProvider<LoginViewModel> {
   4:void IMetadataProvider<LoginViewModel>.BuildMetadata
   5:             (MetadataBuilder<LoginViewModel> builder) {
   6:  
   7:                 builder.CommandFromMethod(x => x.SaveCore()).
   8:                     DoNotCreateCommand();
   9:                 builder.CommandFromMethod(x => x.SaveAccount(default(string))).
  10:                     CommandName("SaveCommand").
  11:                     CanExecuteMethod(x => x.CanSaveAccount(default(string)));
  12:         }
  13:     }
  14:  
  15:publicvoid SaveCore() {
  16://...
  17:     }
  18:  
  19:publicvoid SaveAccount(string fileName) {
  20://...
  21:     }
  22:publicbool CanSaveAccount(string fileName) {
  23:return !string.IsNullOrEmpty(fileName);
  24:     }
  25: }

The extension methods of the DevExpress.Xpf.Mvvm.POCO.POCOViewModelExtensions class support manually raising a PropertyChanged event or updating a command:

   1:publicstaticclass POCOViewModelExtensions {
   2:publicstaticbool IsInDesignMode(thisobject viewModel);
   3:publicstaticvoid RaiseCanExecuteChanged<T>(
   4:this T viewModel, Expression<Action<T>> methodExpression);
   5:publicstaticvoid RaisePropertyChanged<T, TProperty>(
   6:this T viewModel, Expression<Func<T, TProperty>> propertyExpression);
   7: }

For instance:

   1:publicclass LoginViewModel {
   2:publicvoid Update() {
   3:this.RaisePropertyChanged(x => x.UserName);
   4:this.RaiseCanExecuteChanged(x => x.SaveAccount(default(string)));
   5:     }
   6:  
   7:publicvirtualstring UserName { get; set; }
   8:publicvoid SaveAccount(string fileName) {
   9://...
  10:     }
  11:publicbool CanSaveAccount(string fileName) {
  12:return !string.IsNullOrEmpty(fileName);
  13:     }
  14: }
Services

As you likely know, the DevExpress MVVM Framework provides a service mechanism. Previously, accessing a service required inheriting from ViewModelBase and implementing the following construction:

   1:public IMessageBoxService MessageBoxService { 
   2:     get { return GetService<IMessageBoxService>(); } 
   3: }

You can now write:

   1:publicvirtual IMessageBoxService MessageBoxService { get { returnnull; } }

Use the ServiceProperty attribute or the Fluent API, as earlier described, to control service property generation.

 

Is there a performance penalty for working with POCO?

The ViewModel created by ViewModelSource is a descendant of the passed class. This descendant is generated using System.Reflection.Emit to implement INotifyPropertyChanged, override virtual properties, create commands, etc. Although these operations are handled at runtime, performance degradation is not an issue because the mechanism uses a cache -- generation is performed once only for each class and not for each instance of a class. By the way, Entity Framework 5.0+ uses the same mechanism.

ViewModelSource supports several approaches to create ViewModels.

  1. For a ViewModel with a public parameterless constructor, the following approach is simple and fast:
    ViewModelSource.Create<LoginViewModel>();
  2. Since lambda expressions are not comparable, they remain uncached and compiled anew with each method call. While this approach is the most powerful and beautiful, it is also the slowest:
    ViewModelSource.Create(() => new LoginViewModel(caption: "Login") {
    UserName = "John Smith"
    });
  3. Since compiled delegate instances can be cached, this is a fast approach for passing parameters to the ViewModel constructor: 
    var factory = ViewModelSource.Factory((string caption) => new LoginViewModel(caption));
    factory("Login");

Is there a live example of POCO ViewModels?

With 13.2, we introduce a new real-life demo – Sales. This demo is built completely on the POCO technology, so you can examine its code.

Moreover, DevExpress Scaffolding Wizards now generate ViewModels as POCO. Here is a tutorial describing how to build an application with Scaffolding Wizards. You can also scaffold Views based on your POCO ViewModels - simply add the DevExpress.Xpf.Mvvm.DataAnnotations.POCOViewModel attribute to the ViewModels.

P.S. What could be better than the previous approach? Right, dropping the requirements of virtual properties and creating ViewModel instances via a special factory. We are currently working on this and will introduce a solution in the near future.

P.P.S. In fact, the POCO ViewModels functionality is a good example of the Aspect-oriented Programming paradigm. Previously, inheriting from ViewModelBase meant implementing cross-cutting concerns across ViewModels (i.e. similar code in the definitions of the bindable properties and commands). Now, you can get rid of this redundant code with aspects (e.g., conventions for defining properties and methods, attributes, and Fluent API).

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. THIS POST: DevExpress MVVM Framework. Introduction to POCO ViewModels.

New in CodeRush 13.2: Unit Test Builder

$
0
0

Here’s a new feature that will help you generate test cases as you’re stepping through code. You know the scenario – you’re debugging and find a problem caused by the data passed in or the state of the software. You might want to continue stepping through the code but you also want to add a test case for the method you’re in right now.

CodeRush has a cool new feature to help out in this situation. The Unit Test Builder (UTB). Here’s how it works:

  1. You will need at least one test project referencing at least one test framework. Which framework you pick doesn’t matter. CodeRush supports them all, and the UTB supports projects with references to multiple test frameworks.
  2. Start your debugging session and get to someplace interesting. For example, here I have a call to a class that calculates prime numbers:

    SteppingThroughTheCode

    As you can see from the Expression Explorer, we’re passing in 4 and the IsPrime method is returning true. Four is NOT a prime number, so this is clearly a bug. Let’s step into the IsPrime method…

    IsPrime

    This is the method that is returning the incorrect value when the candidate parameter is four. Four is not a prime number, so it should return false instead of true. We can figure out why later, but for now we should add a test case, so we….
  3. Press Ctrl+Alt+Shift+T to generate a new test case for this method, with the data passed in matching our arguments. The Unit Test Builder will appear:

    utb1
    Here you can see a list of tests that will be generated after the debugging session ends. Hovering over the method in the “Method Called” column produces a hint showing the values passed in:

    utb1withparams
  4. Let’s rename the test method. Let’s call it FourIsNotPrime.

    utb1rename
  5. We can place this method inside a different class if we want, or we can use the existing test class, or we can create a new test fixture to hold our test method.

    utb1NewClass
  6. Finally, we can add optional remarks that will appear inside an XML doc comment.

    utb1comment

    Note that all of these steps with the UTB (4-6, above) are completely optional. You can continue to debug and add test methods without making any changes to the names of the test methods or where they will be placed.
  7. Continue to debug, and add more tests as needed.

    utb2
  8. Finally, when you’re finished, stop the session or close the application you’re debugging just as you normally would. At this point all the tests we’ve added to the UTB will be generated.

    utb3

    Double-click a test in the UTB to navigate to that test.
  9. Now you add the assertion code (CodeRush has templates for this – “at” yields Assert.IsTrue, and “af” gives you Assert.IsFalse, for example).

The final code for our test fixture looks like this:

[TestClass]
public class CalculatorTests
{
  Calculator _Calc;
  [TestInitialize]
  public void Initialize()
  {
    _Calc = new Calculator();
    _Calc.Owner = this;
  }
  [TestMethod]
  public void TestIsPrime5()
  {
    int candidate = 5;
    bool result = _Calc.IsPrime(candidate);
    Assert.IsTrue(result);
  }
  [TestMethod]
  public void TestIsPrime10()
  {
    int candidate = 10;
    bool result = _Calc.IsPrime(candidate);
    Assert.IsFalse(result);
  }
  // These two methods were generated following the
  // steps shown above in this blog. Note that the
  // UTB is smart enough to realize that we need
  // an instance of Calculator and that this test 
  // fixture already had one. So we use that instance 
  // in the generated test methods. 
  /// <summary> 
  /// Four is not a prime number! 
  /// </summary> 
  [TestMethod]
  public void FourIsNotPrime()
  {
    int candidate = 4;
    bool result = _Calc.IsPrime(candidate);
    Assert.IsFalse(result);
  }
  /// <summary> 
  /// Nine is not a prime number! 
  /// </summary> 
  [TestMethod]
  public void NineIsNotPrime()
  {
    int candidate = 9;
    bool result = _Calc.IsPrime(candidate);
    Assert.IsFalse(result);
  }
}

The UTB is pretty cool. Give it a try and let us know what you think.

DevExpress Universal 13.2: Building modern apps everywhere

$
0
0

If you’ve been a DevExpress customer for a while now you’ll know the cadence of our releases: June and December, named year dot 1 and year dot 2. So it should come as no surprise that this week is the week we’re releasing the second major release of 2013 for the .NET and Visual Studio platforms. As I look through the What’s New for Universal, I’m struck firstly by the depth of some of these new features and secondly by the breadth of platforms they cover.

With this announcement blog post though, I’m not going to just reiterate all of the entries in that What’s New page since I’m certain you’re perfectly capable of browsing through that set of pages without a guide. Instead I’m going to take a look at the new features thematically, and the most prominent motif I see is creating modern apps.

By “modern apps”, I’m not just talking about tiles and touch and flat UI. If that’s all this post was, I don’t know who would get utterly bored first: you reading it or me writing it. Agreed, there is a lot of that aspect to creating a modern app, but I want to define the term more broadly. Over the years, I’ve seen the general line-of-business applications we write surfacing data analytical tools as part of the app as well as shifting to being more modern in appearance. Users now expect not only grids (with the full panoply of sorting, grouping and filtering functions) but pivot grids, charts, reporting, and dashboards in their apps. They want to extract information from their data, and to present it in a visually arresting and beautiful manner. I’d say that’s what modern apps are all about.

New features and enhancements

DevExpress WPF Office 2013 Dark Gray Theme

Themes. Yes, I know, I said I wasn’t going to talk about them, but I should at least point out that we now have new themes across the board. WinForms gets three themes inspired by Visual Studio (Visual Studio 2013 Blue, Black and Light); WPF and Silverlight get two Office-inspired themes, Office 2013 Dark Gray and Office 2013 Light Grey, as well as a special touch-centric modern theme called TouchlineDark; and DevExtreme gets a couple of new themes, the first for Android (Holo Light), and a generic, non-platform-specific theme for those times you want the same look and feel across all devices. Not to be outdone, ASP.NET and MVC gain a Moderno theme.

DevExpress ASP.NET Ribbon

Ribbon. Like it or not, but in this age of touch-enabled devices and laptops, the ribbon turns out to be a clever well-thought out UI concept and so ASP.NET/MVC finally gains a Ribbon control of its own. We’ve also increased the use of our Ribbons: many controls, such as the spreadsheet, now have the option to prefill the form’s ribbon with standard buttons and actions.

DevExpress WPF Spreadsheet

Spreadsheet Control. In 13.1, we previewed a spreadsheet control  -- the ultimate data analysis tool in a way – for WinForms. The control comprises two main parts: a highly-optimized spreadsheet engine that knows about cells, worksheets, formulas, the usual spreadsheet file formats, and so on, and a presentation part that has an auto-generated Ribbon UI and can display and edit data in cells. Thanks to this foresight, in 13.2 we’ve now provided a spreadsheet control for WPF and, get this, ASP.NET WebForms. Not only that, but we’ve added support for charting and mail-merges. And of course, since it’s a DevExpress control – it participates in our theming support. All in all, you can now easily create a modern analytical app on the web or for Windows.

Windows 8 PDF Viewer Control

PDF Viewer. Again, in 13.1 we previewed a PDF Viewer control for WinForms, with the same kind of split between “engine” and presentation as we did for the spreadsheet. In 13.2 we’ve added a PDF Viewer control for WPF and Windows 8 XAML (preview only). There’s support for zooming, scrolling, text search, embeddable fonts, and so on. The traditional Windows platforms have a ribbon interface and a search UI; the Windows 8 version supports full touch capabilities and rendering to a DirectX drawing surface for speed.

DevExpress HTML-JS Bubble chart

Charting. For WinForms and ASP.NET/MVC, there’s Legend Check Boxes to allow users to toggle the visibility of chart elements, and there’s automatic data aggregation of data based on chart size and zoom level. WPF and Silverlight allow for the Legend Check Boxes too; WPF also gains sparklines. The DevExtreme team have outdone themselves, and provided a plethora of new data visualization functionality: Bubble charts, constant lines, crosshairs, shared tooltips, data aggregation, logarithmic axes, and so on.

DevExpress WinForms Map Control

Maps. These controls have become very popular on every platform, so we’re happy to announce improvements to all our map controls. The WinForms Map Control gains automatic zooming and panning, as well as printing. It has support for route planning using Bing Services. For WPF and Silverlight we have support for item virtualization via web services to provide faster performance. DevExtreme acquires a vector map widget, allowing you to quickly configure a map with markers, tooltips, zooming, and centering.

DevExpress Dashboard IDE Integration

Dashboards. The biggest news here is Visual Studio integration: you can now create dashboards from within your favorite IDE. OLAP servers are now supported, as well as calculated fields and Dashboard parameters. Other additions include shapefile maps and sparklines.

DevExpress Reporting Pre-printed Forms

Reporting. There are new features across the board for DevExpress reporting. XtraReports Suite gains a new document view control for ASP.NET, support for pre-printed forms. and an enhanced user experience for Print Preview (such as the ability to print report selection, navigate to page number). Report Server now includes support for stored procedures and editable HTML email templates for server notifications. SNAP Reports provides mail merge capabilities, an integrated Query Builder (with parameters), and sparklines. XAF now integrates XtraReports at design time in the new ReportsV2 Module.

Document Server. The new PDF Document Processor can find text in PDFs and retrieve results, extract text from PDFs, export any page as an image or print it. The Spreadsheet Document Processor now performs mail merge and data export operations.

DevExpress XAF soft validation

XAF. Apart from the ReportsV2 Module discussed above: support has been added for custom fields (and at run-time too) and soft validation rules (where entities can be committed with warning-level data errors).

DevExtreme AndroidLightTheme

DevExtreme. There’s a lot of new functionality here, some of which has already been mentioned. I’ll switch to a bulleted list for the rest:

  • Visual Studio integration has been enhanced greatly. There’s TypeScript support and a much-improved DevExtreme View Designer.
  • Support for iOS7 and Tizen has been added.
  • Angular.js is now supported for the UI widgets.
  • The already extensive list of mobile widgets has been supplemented with a pivot and a panorama widget (inspired by the similar widgets on Windows Phones), a popover widget (and toast), a radio group, an autocomplete textbox, a n action sheet, and so on.
  • The list widget is now editable and, at your discretion, allows end-users to select and/or delete items, but even bigger than that, we’ve added support for webkit-based CSS native scrolling.
  • You can now fully localize DevExtreme applications as required. Dictionaries for the text, captions, and messages that are added by the framework to your applications are supplied with the product. In addition, you can now generate custom user dictionaries with the strings used in your application.
  • You can now use TypeScript (instead of JavaScript) when developing mobile apps with DevExtreme . The distribution includes a project template that references the framework's TypeScript definition files and provides sample TypeScript code required when developing a DevExtreme application.

DevExpress CodeRush Debug Visualizer

Last, but not least, CodeRush. Its XAML support has been improved with renaming identifiers, navigating through references, as well as showing code issues for undeclared static resources and obsolete members. The Debug Visualizer has had many enhancements, not limited to evaluating arguments and variables in VB and JavaScript, better evaluation and display of expression values, a unique visualization for out and ref arguments, and improved common debug workflows, such as stepping into LINQ queries and nested lambda expressions.

Summary

I hope I’ve shown how Universal 13.2 has expanded the definition of what it means to be an modern app. It’s not just eye-candy in the form of touch-enabled controls and modern flat UIs, but brain-candy in the form of advanced analytical and data visualization controls. By reading between the lines, you’ll also have a good idea for some of the things we’ll be adding in 2014. Stay tuned to see if you’re right!

New CodeRush Plugin – Cleanup File and Namespaces

$
0
0

This plugin wraps up 2 existing tasks (The ‘CleanupFile’ command and the ‘Optimize Namespace References’) in to a single new command ‘CleanupFileAndNamespaces’.

In order to use this plugin:

Step 0 – Requirements

This plugin requires version 13.2 of CodeRush and a non-express version of Visual Studio version 2010 or higher.
If you have a current CodeRush subscription, you can download the latest version through our download centre.
If not, you can download a 30 day trial of all of our .Net products, including CodeRush.

Step 1 – Download

This plugin is hosted on GitHub and is available as either VSIX or as Sourcecode

VISX_CleanupFileAndNamespaceCleanupFileAndNamespacesSourceCode

Step 2- Install

If you have downloaded the source, you will have to compile the plugin yourself, and then install from the VISX which the compile process creates.

Once you have the VISX, (via download or compilation) simply double click it, and follow the prompts.

CleanupFileAndNamespacesInstaller

Step 3 - Configuration

All that is necessary to configure this plugin, is to assign a key to the new ‘CleanupFileandNamespaces’ command.

This is done via the Shortcuts options page.

  • To open the options screen either choose DevExpress\CodeRush\Options from the main menu, or use the Ctrl+Shift+Alt+O shortcut.
    To locate the shortcuts options page, locate the IDE\Shortcuts item in the tree on the left, or use the ShortcutsPageIcon icon in the upper right of the options screen.
  • CleanupFileAndNamespacesNewShortcut  Create a new shortcut by right clicking in an appropriate folder and choosing ‘New Keyboard Shortcut’ or ‘New Mouse Shortcut’.
  • CleanupFileAndNamespacesShortcutKeysThen choose a suitable key or mouse combination based on your preferences and previous choice. I usually pick Ctrl+T for testing purposes.

 

 

CleanupFileAndNamespacesCommand Next choose the ‘CleanupFileAndNamespaces‘ command from the commands dropdown.

Finally you should set the context of this command to make it only available when you are within a .vb or .cs file. CleanupFileAndNamespacesContext

Finally click OK to accept your changes.

Create a new shortcut and assign it to the the ‘CleanupFileAndNamespaces’ command.

Step 4 – Usage

  • Place your caret in any .cs or .vb file. and invoke using the configured shortcut. CodeRush will run the ‘Optimize Namespace References’ refactoring and follow that by running any configured Code Clean operations.

For example:

The following is a fresh C# Library project, with a single unused variable declared.

SimpleClassLibraryWithUnusedDeclaration

Assuming that you have the default settings for Code Cleanup, and you trigger CleanupFileAndNamespaces from this start position, CodeRush will remove the unused using directive and the unused declaration:

SimpleClassLibraryWithUnusedDeclarationAfterCleanup

This simple plugin links together 2 often used features so that they can operate as one.

In my next post I’ll explain how this plugin works in detail.

DevExpress MVVM Framework. Interaction of ViewModels. Messenger.

$
0
0

An application’s architecture depends on the degree of connection between its modules. Loosely-coupled systems are suited for large applications. This usually means many scattered modules, operating without awareness of each other. Ideally, modules are the building blocks of an adaptive design. Loosely-coupled architectures are easy to support and improve because adding or removing functionality simply means registering or unregistering a specific module without concern towards the others.

To facilitate interaction between modules, we implemented aclass to exchange messages regardless of which module is sending or receiving the message. This class is Messenger.

Let’s examine a simple sample to get a clearer understanding.

Imagine we have a database which can be modified from several modules. One module will need to be notified when modifications happen (e.g., adding, removing, and changing a record). We’ll first need to create a message:

   1:publicenum MessageType { Added, Deleted, Changed }
   2:publicclass Message {
   3:public MessageType MessageType { get; private set; }
   4:publicobject RecordID { get; private set; }
   5:public Message(object recordID, MessageType messageType) {
   6:         RecordID = recordID;
   7:         MessageType = messageType;
   8:     }
   9: }

We can then subscribe to the message from anywhere in the application. For instance:

   1:publicclass Module1 {
   2:public Module1() {
   3:         Messenger.Default.Register<Message>(this, OnMessage);
   4:     }
   5:void OnMessage(Message message) {
   6:switch(message.MessageType) {
   7:case MessageType.Added:
   8://...
   9:break;
  10:case MessageType.Changed:
  11://...
  12:break;
  13:case MessageType.Deleted:
  14://...
  15:break;
  16:default:
  17:thrownew NotImplementedException();
  18:         }
  19:     }
  20: }

Sending a message is even easier:

   1:publicclass Module2 {
   2:void SendMessage() {
   3:         Messenger.Default.Send(new Message(0, MessageType.Added));
   4:     }
   5: }

As you can see, this approach implements module interaction without reference to a module’s code. Even if you remove Module1 or Module2 while developing the application, it will not cause errors and the entire system will continue to function.

We also prepared a real example with this architecture. It can be found here. Screenshots of the example are below.

4.Blog.Messaging.001

4.Blog.Messaging.002

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. THIS POST: DevExpress MVVM Framework. Interaction of ViewModels. Messenger.

VCL Roadmap news: Delphi 7 and 2007 support

$
0
0

We’ve just completed our Company Summit for 2014, where we all meet up, management and team leads alike, to discuss and formulate a plan for the following year. One of the results from this endeavor is our annual Roadmap, which we publish late December/early January. Prior to this being published – and rather than burying this news in the middle of what is going to be a large document – I wanted to call out a decision we made with regard to the DevExpress VCL Subscription.

Delphi RoadsignI’ve been saying for a while now that supporting Delphi 7 and Delphi/C++Builder 2007 is proving to be less and less viable. These older versions use shortstrings, have no modern language features, have issues with Windows Vista (!) and later (and I’ll put on my Microsoft PSA hat here and reiterate that Windows XP support is gone forever in April next year). And then I read Warren Postma’s excellent article he published a couple of days ago: “ Modernize your codebase: Inspiration to Ditch your Ancient Delphi Version”, which in essence cemented some of the feelings we have in supporting these older compilers.

We have in place plans for providing some major new controls and features for our VCL Subscription in 2014. It should come as no surprise that these features will be inspired directly from some of the new WinForms controls and improvements we’ve provided during 2013 (here’s a list of those, should you be interested – try and guess which ones we’ll be doing for VCL in 2014). The great thing about doing it this way is that the WinForms team have found all the design and platform issues and worked around them, meaning the VCL team can avoid them and produce equivalent controls more easily. As a quick example: consider pixel scrolling. We provided it for DevExpress WinForms and then we added it to DevExpress VCL – but the WinForms team had to work out all the nuances and problems.

But… the run-times are different (.NET is not VCL, C# is not Delphi) and so despite that there’s still quite a bit of work to do. There ain’t no such thing as a free lunch, and all that. Compounding that with the need to consider shortstrings, the lack of generics, rudimentary interface support, a less sophisticated IDE, and so on in order to support Delphi 7 or 2007, means that our workload increases dramatically to offer a new control for arguably not much benefit. We’d rather expend our time and resources to implement new functionality for the majority than to shoehorn in a new control into a 7 to 10-year-old compiler and run-time for the small number who are still on those platforms. Hence our decision:

From 14.1 onwards, all new controls and features published in the DevExpress VCL Subscription will only be for Delphi/C++Builder XE or later, whether 32-bit or 64-bit.

My strong recommendation is to upgrade to Delphi or C++Builder XE5 – Embarcadero do have some attractive upgrade discounts at the moment – for at least your new projects. I’d also move your older projects forward as well, but I recognize that many people are using pre-compiled libraries from now-defunct companies and can’t do so. Either way, if you do want to use these new 2014 controls you will have to use a more modern compiler and IDE.

ASP.NET WebForms & MVC: GridView Batch Edit (What's new in 13.2)

$
0
0

Check out the DevExpress ASP.NET GridView's excellent new editing feature in the latest 13.2 release:

GridView Batch Editing

DevExpress ASP.NET GridView Batch Editing

The DevExpress ASP.NET Grid (ASPxGridView) control allows you to modify a batch of grid data on the client side and send it to the server in one request.

Benefits

Batch Edting allows your end-users to work in the DevExpress ASP.NET GridView control with ease. They can edit all the records using the keyboard only without moving their hand to reach for the mouse. And once they're finished, the can review, cancel, or save their changes.

The DevExpress ASP.NET GridView also gives your end-users a great preview of what records have been changed before they're saved back to the server. And, like many DevExpress controls, you can choose the color that signifies an edited cell.

Note: If the end-user chooses another action like sorting while they're batch editing, the DevExpress ASP.NET GridView will ask them if they want to lose their changes. So your end-users will get a helpful notification and can choose to continue editing or choose a new action.

ASP.NET WebForms & MVC

The GridView Batch Editing feature is available for both ASP.NET WebForms and MVC platforms.

How To Use

To enable the batch editing functionality, set the Mode property to 'Batch'. In this mode, the grid data contained in a page can be edited using in-line editors. The modified cells are colored in green. All changes are maintained on the client side until the Save changes link is clicked. You can cancel all changes by clicking the Cancel changes link.

If a grid contains modified data, it displays a confirm message before a grid callback or postback is performed.

In this demo, use the Edit mode combo box (“cell” or “row”) to specify the control element used to edit the data. The Start edit action combo box (“click” or “double click”) allows you to specify the action that should be used to begin editing grid data.

Online Demos

WebForms: DevExpress ASP.NET GridView Batch Editing Demo

MVC: DevExpress ASP.NET MVC GridView Batch Edting Demo

Download the latest version of DevExpress ASP.NET today and try the slick new batch editing feature of the DevExpress ASP.NET GridView.

 

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/


How To Customize DevExpress ASP.NET Check Box control for the iOS theme

$
0
0

The DevExpress ASP.NET controls are customizable. In fact, you can do things like move text from the left side of a control to the right side:

DevExpress ASP.NET Check Box with iOS Theme

In the image above, there is a DevExpress ASP.NET CheckBox control and CheckBoxList control. Both of these are displaying the DevExpress iOS theme for our ASP.NET products. The DevExpress ASP.NET iOS theme allows you display DevExpress ASP.NET controls with a native iOS look. However, they are still ASP.NET controls and not native apps. To create native apps using HTML5, check out DevExtreme.

Still, the iOS theme is very useful in getting reach for your websites and giving your end-users a familiar experience.

CheckBox & iOS Switch

On iOS, a check box is displayed as a switch control. This makes it easier for users on mobile devices to touch (select) and get notified of the changed state.

However, a customer asked if this was possible:

One thing I’d like to see added is a property when using IOS theme, to have the “switch” be to the left of the text. And possible a column width property when multiple columns are used to correct for the case as shown below, where even a short line of text gets put on 2 lines. -James

For reference, James has a website created with DevExpress ASP.NET controls. The website is slick in that uses browser detection and automatically displays the iOS theme for mobile devices. James says that this solution has worked out well for them and their users seem to like it too.

Custom Text Alignment

To solve James' question, we can do 3 easy things with DevExpress ASP.NET that do not require a new theme or property to be created:

1. Set the ASPxCheckBox/ASPxCheckBoxList TextAlign property to "Right" to show a label on the right side of a switch.
2. Set the Web.config -> devExpress -> themes -> styleSheetTheme property (not the "theme" property) to "iOS" to keep the markup style settings (see the http://www.devexpress.com/kbid=KA18643 KB Article for details).
3. Define a specific CSS selector to avoid text wrapping (see the 
https://www.devexpress.com/issue=Q464106 KB Article for details):

Page:

<style type="text/css">.SwitchNoWraplabel { white-space:nowrap!important; }</style>

ASPxCheckBox:

<dx:ASPxCheckBoxID="ASPxCheckBox1"runat="server"Text="Switch Demo"TextAlign="Right"SkinID="Switch"></dx:ASPxCheckBox>

ASPxCheckBoxList:

<dx:ASPxCheckBoxListID="ASPxCheckBoxList1"runat="server"CssClass="SwitchNoWrap"TextAlign="Right"RepeatDirection="Horizontal"RepeatColumns="2"><Items><dx:ListEditItemText="Item 1"/><dx:ListEditItemText="Item 2"/><dx:ListEditItemText="Item 3"/><dx:ListEditItemText="Item 4"/></Items></dx:ASPxCheckBoxList>

Web.config:

<configuration>
  ...<devExpress><themes...styleSheetTheme="iOS"theme=""/></devExpress></configuration>

Download a sample project with the above settings here:
DevExpressASPCheckBoxiOSDemo.zip

(Use the DevExpress Project Converter tool if you're using a different version than 13.2.5).

iOS Guidelines

In my discussing this approach with one of our DevExpress iOS developers (and overalll fan), he mentioned that putting the caption on the right side of a switch is not standard on iOS. However, because this is a ASP.NET website and not a native app, you will not have to worry too much about Apple's App Store guidelines, with the proviso that you may confuse your end-users if they are used to the standard text alignment.

You can read the Apple iOS Human Interface Guidelines here.

Rest assured, though, that when the DevExpress ASP.NET team created the iOS theme we followed these guidelines as much as possible and as much as was feasible.

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/

CodeRush Plugin – Cleanup File and Namespaces - How does it work?

$
0
0

As promised in my last post, I’m going to explain just how the CleanupFileAndNamespaces plugin works.

To recap, this plugin creates a new Command (CleanupFileAndNamespaces) which will cause CodeRush to fire the “Organize Namespace References” refactoring followed by the “CleanupFile” command.

So how does it work?

Overview

This plugin consists of a single new command. When this command is triggered, it will perform a simple sequence of steps, which together will create the effect we are after.

The high-level steps are:

  1. Store current location
  2. Execute CleanupFile command
  3. Move caret to first using \ Imports directive
  4. Execute Optimize Namespace References refactoring
  5. Restore Caret location.

We’re going to look at 2 through 4 first and then revisit 1 and 5 together,

Execute the CleanupFile command

Executing an Command requires that we first know the name of the command we want to execute.


CommandListIn this case I know that the command I want is called CleanupFile.
However if I did not, the best place to check would be the Shortcuts options page.

The Options screen can be found via DevExpress\CodeRush\Options.
The Shortcuts page can be found at IDE\Shortcuts.

On the right of this page is a dropdown labelled Command.
This dropdown contains a list of all the Commands that CodeRush is aware of.

Remember from previous blog posts that everything about CodeRush is dynamic, and so if you create a new action (the internal name for a command), you’ll find that CodeRush will list that action in this dropdown as well.

We’d like to execute a command to cleanup the current file. Looking down through the list of commands, we soon come across several which are prefixed with the phrase Cleanup. They appear to work at a number of different levels (File, Folder, Project and Solution). We’ll pick CleanupFile for our plugin.


Once we know which Command we’d like to execute, we need to get a reference to it in code. Internally commands are known as Actions. So in order to get a reference to the CleanupFile action, we would use code like….

GetActionCleanupFile

Having got a reference to the action, we can execute it like so….

ActionExecuteCleanupFile

Now that we know how to execute an action, let’s move on to the slightly more complex task of executing a refactoring.

Position the Caret.

Refactorings are very context sensitive and are typically not available all of the time. In this case the caret must be placed on a using (or imports) directive, before it will be available to use.

In order to locate the first using\imports directive, we will use an ElementEnumerable object.

This class is created with a scope (the Active File) and a LanguageElement Type (NamespaceReference – The internal name for a using or imports directive).

ElementEnumerable

Then we ask this class to enumerate and provide us with the first matching Element it can find.

GetFirstNamespaceReference

We use FirstOrDefault(), because it will return a null if no appropriate element is found. This is a sensible precaution, since there may not be any NamespaceReferences in the current file.

Once we have a reference to the NamespaceReference, we can use it’s location as a destination to move to.

Actually moving the caret into position is a simple matter of …

MoveCaretToReference

Once in position, we will be able to get a reference to the Refactoring in a very similar manner to that of obtaining a reference to an action

Execute the Refactoring

Again we need to know the name of the refactoring that we’d like to execute. In most cases the name of the refactoring, is the same as the display name of the refactoring, so you can just copy the text that you’re used to seeing when you execute a refactoring from within CodeRush.

In this case the refactoring we want to execute  is “Organize Namespace References

We can get our reference like this…

GetRefactoringOptimizeNamespaceReferences

Refactorings are executed via their Execute method. however we must first check if the refactoring is available. Only once we have confirmed availability, can we execute the refactoring.

ExecuteRefactoring

Saving and restoring the caret location.

As you have seen, executing the ‘Optimize Namespace References’ refactoring, requires that we move the caret to a using\imports directive in order that it can function. Further, executing the CleanupFile action typically moves he caret to the end of the file which is processed. So no matter which way you look at it, the caret will not remain in its initial location.

We should really do something about this, so let’s store the location of the caret at the start and return it to this location at the end of our action.

We could capture the exact coordinates of the caret, but the we know the file is about to be altered. If anything above our caret’s initial position is removed, or added, then the stored position will be unlikely to make much sense afterwards.

We could also bind the stored coordinates to the code, which would allow them to be adjusted up and down in these cases. however if methods are reordered this will still likely leave us in a strange location.

So what to do? Should we give up and just leave the caret at the top or bottom of the file?

Of course not.

As luck would have it, the latest version of CodeRush provides us with a new subsystem for exactly this sort of situation.

The new NavigationServices subsystem provides us with the means to capture our current location in terms of our place within the hierarchy of code elements.

We get the current location and store it with…

GetStartAddress

Once we are done with our modifications, we can restore the relative position of the caret with…

ResolveAddress

Our New Action

So now that we have all of the constituent parts of our plugin, we need a way to trigger their execution.

There are several options available to us: Refactoring, CodeProvider, Command etc.

Whilst one of the pieces used is a Refactoring, the combined effect is not.

One characteristic of Refactorings and CodeProviders is that they present themselves contextually through the CodeRush SmartTag menu. This allows the Refactorings and CodeProviders to indicate when they are available.

Our function would theoretically be available from any position in any C# or VB.net file. This means that it would show up all the time. This in turn would reduce the effectiveness of the SmartTagMenu. Therefore I decided not to implement the new functionality in either of these ways.

Instead I chose to implement a new Action. If you recall, an Action is the internal name for a Command. These commands\actions are bindable to shortcut keys

I created and registered the Action with the following code:

CleanupFileAndNamespacesRegistrationGeneric2

This is pretty much boilerplate stuff aside from the indicated customizations. The first of these is the Name of the new action. This is the value you will look for in the commands drop down on the shortcuts option page. The second of these is a reference to the method to execute when the action is triggered.

Final steps

The final steps are pretty simple.

Implement the CleanupFileAndNamespaces_Execute function using all the code from the first half of this post.

Then, lastly, be sure to call registerCleanupFileAndNamespace method from within your plugin’s InitializePlugIn method otherwise all of that lovely code, will never run at all. With that, we have all the elements we need and our action is complete.

The full sourcecode for this plugin is available on github, as is the binary version

DevExpress VCL 13.2: Modernizing your apps

$
0
0

As long-time customers know, we release our new major versions at the end of the first half of the year and at the end of the second half (June and December, usually). A couple of weeks ago, we released DevExpress Universal 13.2, so this week it’s the turn of our VCL subscription. DevExpress VCL 13.2 continues our current momentum to help you show your customers and end-users that Delphi and C++Builder can be used to produce modern apps, with fresh designs and up-to-the-minute user experiences. It really is time to move away from those grey late-90s application designs.

So if I had to pick a topic, I suppose the main motif with VCL 13.2 is modernizing your apps. New themes, touch capabilities, tablet-like behaviors all provide a framework for creating a modern UI.

New Features and Enhancements

Improved VCL Touch Experience More Touch. Continuing our efforts to give you touch-centric capabilities in our controls, we’ve added optimized touch behaviors to the Filter Control, the Page Control, the Tab Control, the Date Editor (shown), and the Blob Editor.


VCL Mail Client App Office 2013 Light GrayThemes. Modern apps need modern themes. Meet Metropolis, Metropolis Dark, Office 2013 Light Gray, and Office 2013 Dark Gray. You can now provide the UI your users expect from the latest Microsoft Office suite.


VCL Tree List Pixel ScrollingPixel Scrolling. You know how a list scrolls on your tablet? Buttery smooth, no sudden jumps? We added this per-pixel scrolling to the Table View and the Banded Table View in ExpressQuantumGrid last time, and this time we’ve added it to the ExpressQuantumTreeList, ExpressVerticalGrid, and the Layout View in the grid. When used in Touch mode, pixel scrolling is enabled by default. This feature is available nowhere else, but your users now expect that experience.


VCL Tile Control Small TilesTiles. Windows 8.1 was recently released with a set of enhancements to the Start Screen, and we’ve migrated the major visual ones to our Tile Control. So now you have small tiles, group caption editing and multi-tile rearrangement using drag and drop.


Summary

These are just a few of the enhancements and new features of DevExpress VCL 13.2, mainly those that touch (pun intended) on modernizing your applications. To see all the new features – including the Icon Library and the new Color Picker -- please visit our What’s New page.

I hope I’ve shown how DevExpress VCL 13.2 continues our drive to help you modernize the traditional VCL app. By incorporating the new Office 2013 themes and becoming more touch-aware, your applications will stand out from the crowd. And, by reading what we’ve added to our .NET WinForms product over the past year, you’ll have a very good idea about what’s coming up in 2014. It’s an exciting time to be writing apps with VCL. Stay tuned to see if you’re right!

DevExpress MVVM Framework. Using Scaffolding Wizards for building Views.

$
0
0

Today, we examine using ViewModels to automatically generate Views. Our application looks as follows.

001

When the application starts, the MainWindow shows the GridControl. The Ribbon provides some basic functionality to Add, Remove, or Modify a record, or Print the view.

Clicking Add or Modify opens a View in the detail tab.

002

While the second View is open, the RibbonControl displays its buttons: Save, Close, and Delete. Each save operation is specific to its tab. Changes are committed separately in each of the available tabs.

This simple layout can be automatically generated from ViewModels. You can try this yourself from the sample we’ve prepared. Download and open it from Code Example: E5001.

Notice the provided code of the sample for the model and ViewModels.

The model layer is three classes:Employee, EmployeeContext, and EmployeeContextInitializer.

Employee is a database entity. Entity Framework Code First creates the database during the application’s initial load.

EmployeeContext operates on the database with EF Code First.

EmployeeContextInitializer populates the database with predefined records.

There are two ViewModels.

The first is for the Employee table – EmployeeCollectionViewModel. Since it is a POCO class, its public and virtual properties are bindable and its public methods are available as commands. This ViewModel provides an Employees property for the database records. The available commands add, remove, or modify a record.

EmployeeViewModel is also a POCO class. A value for the Parameter property is necessary for each EmployeeViewModel instance. The parameter describes how the ViewModel operates on records: by creating a new record or modifying an existing one. The Save command commits changes. EmployeeViewModel also contains commands to remove a record or to close the corresponding View.

ViewModel to ViewModel interactions are mediated by Messenger. A message is sent when changes are saved in EmployeeViewModel. EmployeeCollectionViewModel catches this message and updates its View.

That’s it. Now, let’s generate the layout. Remove all the Views and the MainViewModel to follow the steps demonstrated in the video below.

Video

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. THIS POST: DevExpress MVVM Framework. Using Scaffolding Wizards for building Views.

A few more reasons to upgrade to v13.2

$
0
0

13.2 was a great release and many of you already upgraded your applications. For everyone else I am here to help you make that decision sooner and easier, by reminding you what our reviewers had to say, when they upgraded their apps to our latest major release.

These are real world feedback without any kind of interaction from us.

Gustavo Marzioni
Making Business Applications Easier

Gustavo is a veteran programmer (20 years+) with a great presence in our community (most active user in eXpandFramework). He posted a very complete review of all new XAF features and a few other interesting things we released with 13.2 as part of our DXperience subscription. In addition you can find a performance comparison for our new ReportsV2 module.

Mario Blataric
Dungeons of XAF and Magic 13.2

Mario reviews v13.2 and explains how XAF helps him to fight monsters in today’s modern dungeon of dev technologies and platforms. His XAF app has more than 1500 reports so he focuses on the ReportsV2 module.

Martynas Dauciunas
Devexpress 13.2 Review - why bother upgrading ? 

Martynas known from his very useful Excel Import Wizard module wrote an extensive review of all new features and problems encountered when he updated his 12.x ERP/CMMS application to v13.2.

Manuel Grundner

DevExpress 13.2 Review Part 1
DevExpress 13.2 Review Part 2
DevExpress 13.2 Review Part 3

Manuel has already contributed many solutions. This time he wrote a great review for all new XAF features. He also reviewed components not integrated with XAF like the new TaskBarAssistant and as a bonus in part 3 he wrote how to create a module that integrated this component with XAF. This module will soon be integrated into our community project eXpandFramework.

Robert Anderson
DevExpress 13.2 Review - Part 1
DevExpress 13.2 Review - Part 2

Robert is a casual blogger and community contributor. He wrote about all new 13.2 features along with a few more tricks and thoughts which cannot be found in our official posts.

Until next time,

Happy New Year to all!

Viewing all 2401 articles
Browse latest View live