The summer sale is here!

Mindscape Summer Sale 2011

Note: This sale has now ended.

For our friends in the northern hemisphere it’s that time of the year – it’s warming up and there’s a holiday approaching. We thought it would be a great time to offer a special for the summer so that you have a great toolbox at your disposal for when you’re coding away on the beach.

Here’s the deal:

For the price of our WPF or Silverlight suites you can get a full Mindscape Mega Pack upgrade at no extra charge! And to save you money in the long run we’ll also add an additional six months of updates! Now that will afford you a few extra Mojitos!

So that’s every Mindscape product — WPF, Silverlight, Windows Phone, LightSpeed, SimpleDB, you name it — and 18 whole months of nightly builds, upgrades and entirely new products! All at a fraction of the price of other competing suites.

Throw on your skate shoes and roll over to the Summer Sale Page!

Providing your own drop-down list in the WPF Property Grid

Suppose you’ve got a property that you want users to edit in the WPF Elements PropertyGrid control, but rather than the user being able to enter any old rubbish you want to present them with a drop-down list of choices. One simple way to do this is to make the property an enum, but what if the list of choices isn’t known at compile time — for example, if the list comes from a database?

Well, a friend of ours has a feature request in to Microsoft for dynamic enums, where you can choose the enum values at run time, but just between you and me, I wouldn’t hold my breath for that one. In the meantime, fortunately, you can solve the problem old skool. Here’s how.

I’ve written elsewhere about the queer old dynamic pseudo-type system that lives in the System.ComponentModel cave of wonders. One of the many things you can do with this subsystem is to describe a standard set of values, even for properties or types that aren’t enums. An example of this is how in XAML you can write, say, Background=”HotPink” instead of <Button.Background><SolidColorBrush><Color R=”255″ …etc…. WPF defines a standard set of values for the Brush type so that you can specify common brushes by name, even though Brush isn’t an enum.

The secret lies in the TypeConverter class. TypeConverter, despite its name, isn’t just about converting between types. It also has a GetStandardValues() method which you can override to — you guessed it — provide a standard set of values. That standard set of values can come from anywhere, so you can make it up at runtime.

Let’s see this in action. Suppose we have a Penguin object, and we want users to be able to enter the penguin’s species, but we want to assist users by giving them a list of known species to choose from. Since new species of penguin are discovered all the time in the depths of the Amazon rainforest, we don’t want to code this up as an enum — it needs to be a string but it needs to have standard values.

Enter the TypeConverter. We have to create a class that derives from TypeConverter and overrides two methods: GetStandardValuesSupported and GetStandardValues. The first one tells the UI that there are standard values — without it, the grid will assume that there are no standard values and will just display a text box. The second tells the UI what the standard values are. Here’s the implementation:

internal class PenguinSpeciesConverter : TypeConverter
{
  public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
  {
    return true;  // required if you want standard values
  }
 
  public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
  {
    // Ignoring caching and other performance issues
    string[] species = GetSpeciesFromDatabase();
    return new StandardValuesCollection(species);
  }
}

So far so good. Now we need to specify that this type converter applies to our Penguin.Species property. If we had a separate PenguinSpecies type, we could do this at the type level, but since we’re making Species a string, that won’t work. (Technically, it is possible to associate the PenguinSpeciesConverter with the string type, but it would be a really, really bad idea, because it would affect every string in your application.) Instead, we need to specify the type converter at the property level by applying TypeConverterAttribute to the property:

public class Penguin : INotifyPropertyChanged
{
  [TypeConverter(typeof(PenguinSpeciesConverter))]  // hooks up the type converter
  public string Species { /* implementation omitted */ }
}

And this is all you need to do! You don’t need to specify a PropertyEditor in the PropertyGrid control declaration: the grid detects that there is a standard set of values for the Species property and automatically uses a drop-down instead of a text box.

What if your property was of a different type, such as Brush? That is where the convert-y bits of TypeConverter comes in. You can implement GetStandardValues() to return strings, then implement CanConvertFrom and ConvertFrom to convert those strings to the “real” type. Leave a comment if you need more info on this and I’ll try to post some more details.

Want to give it a go? The PropertyGrid control is just one of 35+ stunning controls in our WPF Elements suite. Download the trial here or get free controls here!

WPF Elements 4.0 beta is out now!

WPF Elements 4.0 beta is out!

The key focus for WPF Elements 4.0 was to include a high performance suite of charting controls to add to the existing 30+ controls. We delivered a fantastic range of charting controls for Silverlight in 2010 and had great feedback that developers wanted to see the same offered in WPF Elements.

Chart types included in WPF Elements 4.0

  • Bar
  • Line
  • Area
  • Pie
  • Doughnut
  • Bubble
  • Scatter
  • Spline
  • Spline area
  • Stacked bar
  • Stacked line
  • Stacked area
  • Stacked spline area

Of course new releases aren’t just about new controls – it’s also about improving the existing controls. We’ve added several new features to the scheduler, property grid, outlook bar and drop down edit box. New disabled visual states were added to the Office style themes as well. Bug fixes have been rolled up from the WPF Elements 3.0 nightly builds also.

This is on top of all the existing controls in the suite such as the WPF Property Grid, WPF Scheduler, Coverflow, Multicolumn TreeView and many many more.

Of course with the power of WPF you’re able to customise the look and feel of these charting controls (and in fact any control in WPF Elements) to suit your application’s design aesthetic. WPF Elements includes 5 themes to help you start out with a great look and feel.

Give it a test drive!

Currently all existing WPF Elements customers have access to the beta install bits from their account (You should see “WPF Elements 4.0 – Beta”). Betas are currently only available to customers however we expect to be shipping the final version very soon. If you’re not yet a customer but are working with WPF you should have a look at WPF Elements 3.

Screenshots

Here’s a taste of the charts that are included. They’re from the development team and include examples of custom styles. The screen shots are just a sample of what is possible and obviously don’t show off how fast and interactive the charts can be.

Custom WPF Chart Style with a stacked bar chart
A custom chart style for the stacked bar chart

WPF Bar chart with custom axis labels
Bar chart with custom axis labels

WPF Cylinder Chart
WPF cylinder chart in action

WPF bar chart with data dependant styles
WPF bar chart with data dependant styles – notice how the bars change colour depending on their value

WPF spline chart
WPF spline chart – smooth curves

WPF Stacked Area Chart
WPF stacked area charts

WPF Stacked Spline chart
Of course you can stack spline charts as well.

Logarithmic YAxis WPF chart
Axis scaling is possible, here we have a logarithmic Y axis scale

WPF Doughnut Chart
Doughnut charts – both delicious and useful for showing your data

WPF Pie Chart with partial display
The classic Pie Chart for WPF. Notice that partial pie rendering is possible, in this case one segment is not displayed.

Horizontal Stacked Bar Chart
Data does not need to be displayed vertically. Many different options exist in all charts for controlling the display of the chart data.

We’d love your feedback

As with everything we do, we love to hear our users feedback. Either post a comment below or fire something into our WPF Elements forum.

Nightly news, 12 November 2010

Big news this week has of course been the release of our Silverlight Elements 2.0 control suite — and don’t miss the free book offer for all customers. Of course, we’ve also been busy keeping up with fixes and enhancements on our other products as well. Here’s what’s new in this week’s nightly builds.

LightSpeed

  • We’ve made the “can’t synchronise external class references” designer warning a bit more restrained if you have a lot of classes derived from an external base.
  • Fix for a designer bug where if you selected an entity in the tree view, then hit Del in the filter box, it deleted the entity
  • Fix for an issue with soft delete and joins
  • Fix for an issue with discriminated inheritance and joins

WPF Elements

  • Added support for custom object creation in the property grid “new collection item” button
  • Added work hours customisation to the Scheduler control

These are all available now and you can get them from the usual places.

Nightly news, 15 October 2010

So, did we manage to ship any fixes or enhancements while engaging in our week-long bloggy beardgasm? You bet we did! Here’s what’s new in the latest nightly builds.

Silverlight Elements

  • Added a DataLabel property for all data series (except BubbleSeries — get a real chart, bubble fans!)
  • We’ve changed DataSeries to use a consistent SeriesBrush property, replacing the old BarBrush, BubbleBrush and BogBrush properties

LightSpeed

  • Fixed an error in the LINQ provider if a query traversed a one-to-one association from the end without the foreign key
  • Fixed an aliasing error with value objects in a derived table
  • Fixed an aliasing error in Exists queries with certain database providers
  • Migrations extensibility for full ninja support — we’ll write about this when we’ve had a bit more feedback from users

NHibernate Designer

  • Fixed an issue if a property coincided with the discriminator

WPF Elements

  • Fixed an error in the property grid if the selected object raised PropertyChanged with a null or empty property name
  • Some updates to the MultiCalendar generic style

Where can you get them? From the usual places. When can you get them? Right now!

Archives

Join our mailer

You should join our newsletter! Sent monthly:

Back to Top