BrownBot Logo BrownBot Head

WPF Nav App With Added ZOOM

10:33 pm Filed under: C#,WPF

Here are the results of today’s work:

  • added some zoom controls on the list and detail views.
  • added scroll viewers for the zoomable parts so they behave nicely at the extremes and don’t zoom the clickable controls.
  • Standardized the detail views to 300px so the edit wrap panel looks good and the read only view can scale properly.
  • general cleaned up and lined up of all the elements and borders.

So now it looks like:

SearchSmall SearchLarge

EditSmall EditLarge

Much better, I’ve still got a ways to go on it, one standard feature I know the users are going to ask for is sorting by the grid header (the main reason the current client is still in Delphi 7)… not so easy to implement, I’m thinking some sort of encoded ButtonBase.Click event that passes a parameter through to the ViewModel and some Linq might be the go.

I’ll keep plugging away.

WPF Nav App Design Considerations

4:42 pm Filed under: C#,WPF

I had a great design session yesterday styling up the navigation/view/model app framework I’ve been designing as the basis for the administration program at the mill.

One thing I’m still struggling with is how to effectively handle the huge difference in screen real estate between 1024×768 and 1680×1050.. more than twice the pixels on the screen. The challenge is to not just to make it look half decent but to actually utilise the extra space for displaying data.

Who knows what res we’ll be running in 5 years time?

This is my first draft, my Widget object only has a hand full of fields so really struggles at high res.

Search/Select Screen

SearchSmall SearchLarge

Edit Screen

EditSmall EditLarge

I’m happy with the 3D grey tones, I think I’ve struck a nice balance between looks a function, everything white is pure data, anything intractable is bordered in mid Grey, anything darker is background. I don’t think it’s too heavy, the grays aren’t that far off your standard windows schemes.

With the edit screen I tried a set width on the group borders in a WrapPanel instead of a stack panel, I think that coupled with some zoom controls might be the ultimate solution.

More to come.

Render System.Drawing.Image in WPF

6:36 pm Filed under: C#

I’ve been working on a ViewModel style framework for a big project coming up at work, I decided to add a little spice to the test “Widget” and “Dirchie” objects by including an Image property that loads and saves to the database.

As it turns out it added plenty of spice as it’s not the easiest thing to pull off. Anyhow I eventually got the DB provider loading and saving a standard System.Drawing.Image object, only to find out you can’t actually use it natively in WPF.

Here’s the value converter I wrote to do the conversion for me (the code was adapted from this sample).

using System;
using System.Windows;
using System.Text;
using System.Windows.Data;
using System.Globalization;
using System.Windows.Media.Imaging;
using System.Windows.Interop;
using System.Drawing;

namespace Qaf
{
    [ValueConversion(typeof(Image), typeof(BitmapSource))]
    public class ImageToBitmapSourceConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Image val = (Image)value;

            Bitmap bitMap = new Bitmap(val);
            return Imaging.CreateBitmapSourceFromHBitmap(bitMap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new InvalidOperationException("This should not be called");
        }
    }
}

Holy Diver Quick Concepts

8:26 pm Filed under: Uncategorized

Here are a couple of super quick concept thumbnails for a little collaboration project I’m helping out with.

They were just scribbles while watching TV and a couple more while I was waiting for data to load over the VPN when testing stuff today.

The first of the second lot is the best one yet, I’ll try and knock out an expanded painting of that this arvo.

HolyDiverConcepts1 HolyDiverConcepts2

Powered by WordPress