I’ve spent some free time at work learning WPF. Even after 15 years of windows programming, it’s a bit of a learning curve. I wrote a simple app to simulate a mobile phone – it will integrate with some other code here at work. A few things I’ve learned:

  •  Making buttons that change their appearance when you move the mouse over them or click them
  • Laying out controls in a grid
  • Working with Visual Studio when the IDE doesn’t render your XAML

I wanted to have glass effect buttons and I thought that would mean using Photoshop, which I’d never used before so I installed it from our work distribution and cranked it up. Then I found a tutorial for making glass effect buttons (http://www.associatedcontent.com/article/98189/photoshop_icons_how_to_create_a_green.html). I followed that and them played around with the settings for a day or so and figured out what effect changing each setting would have. I went home and told liz how I’d used Photoshop and was now an expert in it. She laughed – you don’t know hardly anything, you could spend the rest of your life and still not know anything. I think she’s right. it’s a huge program and I’ve just scratched the surface. Anyway, I then felt the number keys should have a metallic look so found a tutorial for that (http://biorust.com/tutorials/detail/31/en/). That link may not always work, but Google “metallic pill button”. Those two sites are great on Photoshop tutorials and I’ll lean more effects from them.

I wanted a button that changed appearance when you clicked on it and found a “How To” from Josh Smith (http://www.infusionblogs.com/blogs/jsmith/archive/2006/09/27/871.aspx). Josh has now moved his blog to WordPress (http://joshsmithonwpf.wordpress.com), but I can’t find this entry there. I followed his sample and got buttons that had different graphics when you hover or click on them. My UI is now a bit messy, but this is just a tutorial so I’m too worried about that.

I wanted to have buttons that would move when you press them – probably a pixel down and right then pop back when you release the mouse. that seems a straightforward thing, but so far I’m still looking at how you’d do that.

However I have found that when you include user controls in your WPF project Visual Studio designer does not work, it failed to display your window. That’s a bit of a worry, and apparently is fixed in the new Orcas release (Mar 2007). I started to download that and after I’d got 4 of the 7 files and spent half a day getting even that far, I wimped out. That upgrade will have to wait for now.

So I’m laying out my window “blind”, which means I’m learning about grids and about borders and so on. That’s useful since I think it’s better to know whow something really works than to just blindly follow someone else’s instructions without knowing what you’re doing.

One of the WPF “rules” is that you shouldn’t be doing things this way anyway. you should create your UI in pure XAML, no images and so forth. If I have free time in the next few weeks, that will be something else to play with.

The bottom line is that I now have an application using WPF that works just like my old Windows app. It looks nicer – apart from my messy attempts at graphics design, but really I’m not sure it adds anything.

It seems it’s like a diary. I had a diary when I was eleven. I think my gran thought that would be a good thing to buy a young lad for Christmas. I remember it was a Letts Schoolboy’s Diary (1969). I remember religiously filling it in every day – for about three weeks. Then the entries would be briefer and less frequent. By the end of February I was recording what was for dinner at school and that was about it. I probably listed my brothers’ and sister’s birthdays (like I would ever forget or be allowed to forget them).

This theme continue for much of my teenage life – I’d get a diary each year off my grandmother, 1970 was a Scouting diary. I remember I didn’t get one in 1971, so went and bought one, but always I’d start adding entries and they would tail off in mid-February. In fact 1971 is particularly poignant; on March 4 – a day that is forever etched in my memory, I had an accident at school – my hand was caught in a door and I lost the end of one finger.  My diary entries stopped abruptly then.

I remember one year, I was reading the Jennings books at school (a series of novels by Anthony Buckeridge detailing the exploits of a group of lads in a boarding school). Jennings had a diary, but to prevent anyone else understanding his entries, he’s write in code. I followed suit, so my entries that year (well for the first few months that year) were written backwards. Another year I was interested in Astronomy and kept a log of what I could see each night (this was a requirement of the Scout’s Astronomer badge) . That month, most entries read “Too cloudy for observation”. Even then the entries got briefer each day so at the end they just read TCFO.

I have no idea where these diaries are now. They’d probably be valuable by now as historical social commentaries and museums would flock to buy them. Imagine if I was as famous as Bill Gates, these would be priceless artifacts.

So is that what a blog is? I have an unnerving feeling these entries will also tail off in a month or so time.

© 2010 Derek Knight's Blog Suffusion WordPress theme by Sayontan Sinha