Before I can start with cosmetic surgery, let's just finish off the SalesModule. The last thing I added here is the Keypad! The keypad is used to type in the barcode and also has an increment decrement button.
I used an ugly hack but I need to suck in all the key presses. If I attach a barcode scanner, it acts like a keyboard so I need to get all the keys pressed (0-9) and also the enter, + and – keys, the rest is ignored. Here is the code that achieves this:
Application.Current.MainWindow.PreviewKeyDown += WindowPreviewKeyDown;
and here is the event handler:
private void WindowPreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
Now we can start making the application look pretty! Hopefully everybody that still reads this blog knows that I am not a designer but luckily there is some help for us developers. :)
I downloaded the WPF Themes from CodePlex and added it to my project. All that is left to do is add it to the resource dictionary:
<ResourceDictionary Source="Themes\ExpressionDark.xaml" />
And it looks a little better… all for free!
Here is the source: