Click here to Skip to main content
15,888,521 members
Articles / All Topics

Building OpenPOS: Part 6 – Make It Look Pretty…

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
6 May 2010CPOL1 min read 9.7K   2   1
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)


Written By
South Africa South Africa
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralLinks Don't Work Pin
Member 36942812-May-11 6:39
Member 36942812-May-11 6:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.