Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / All-Topics

Building OpenPOS: Part 6 – Make It Look Pretty…

0.00/5 (No votes)
6 May 2010CPOL1 min read 9.9K  
Before I can start with cosmetic surgery, let's just finish off the SalesModule.

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:

C#
Application.Current.MainWindow.PreviewKeyDown += WindowPreviewKeyDown;

and here is the event handler:

C#
private void WindowPreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
    // Look at e.Key and if you use it set e.Handled = true
}

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:

XML
<ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="Themes\ExpressionDark.xaml" />                
</ResourceDictionary.MergedDictionaries>

And it looks a little better… all for free!

Here is the source:

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)