Home Contact

X

Coder, not artist.

News

All code on here is free, but as a consequence it's up to you to check it, ha! If you have any questions, please use the contact button!

Twitter












Archives

Post Categories

Image Galleries

Syndication:

WPF


Windows Presentation Foundation

MousePath

A while ago, (and by that I mean over a year ago now) I was catching up on the blogs I read and came across this post: http://blog.iso50.com/14644... I thought – Awesomeness! I’ll give that a go… downloaded the app, and ran it, all good – but only on one monitor… :( I work with two monitors, and found that a lot of the time I’d end up with a no lines as I was on the other monitor… So, I thought I’d give it a go and write one myself… I actually had a working version pretty...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

ObservableCollection Extensions

I’ve had to create a couple of Extensions for the ObservableCollection, (well – I didn’t have to), erm, and so here they are! All are ‘AddRange’ just with different args for different usages.. namespace Extensions { using System; using System.Collections.Generic; using System.Collections.ObjectMo... using System.Linq; /// <summary>Extension methods for the <see cref="ObservableCollection{... class.</summary> public static class ObservableCollectionExtensions { /// <summary>Adds...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

StringFormat annoyances in VS2008

I’ve been using StringFormat in my xaml quite a bit recently, and whilst I’ve liked it, I’ve found that code which is valid tends to cause VS2008 to no longer be able to represent the designer (which some might say is a good thing)… Basically, the following code: <TextBlock Text="{Binding MyValue, StringFormat=The value is {0}}"/> causes VS to basically say ‘no way’ and can no longer render the xaml. Pressing F5 shows the Window just fine… Soo… What can we do about it? If we modify the ‘StringFormat’...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Fun binding an enum value to Viewbox child content

Catchy title eh? I've just solved this problem and thought I'd write about it. To be honest, I'm not sure it's the correct way, but it works, and at the moment, that's what matters. The problem I had was this: I have a property on a class called 'TheEnum', which is defined as such: private MyEnum theEnum; public MyEnum TheEnum { get { return theEnum; } set { theEnum = value; RaisePropertyChanged("TheEn... } } with 'RaisePropertyChanged' looking like this: private void RaisePropertyChanged(string...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Databinding an Enum in WPF...

The situation I have is this - I have a class defined as such: public class MyClass { public int TheInt { get; set; } public string TheString { get; set; } public MyEnum TheEnum { get; set; } } with 'MyEnum' defined as: public enum MyEnum { A, B, C, D } I have a Window that displays the data in such a way: <Window.Resources> <CollectionViewSource x:Key="SortedEnumView"> <CollectionViewSource.So... <ComponentModel:SortDesc... </CollectionViewSource.S...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

The decidedly badly named LoadingCircle WPF Control Pt 2

Badly named Loading Circle PT2 ---------------------------... So, in my last post (http://geekswithblogs.net/... I created a square LoadingCircle UserControl, using old skool WinForms multi-threading in the code behind file, and Xamly fun on the front end.. But there were problems (of course there were), firstly, the animation, whilst it *did* move, was a very 'on/off' affair, i.e. the Ellipse was...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

The decidedly badly named LoadingCircle WPF Control Pt 1

Soooo... I've been playing around with WPF for a while now, generally building small apps for peeps at work, or my own stuff, and one of the things that happens in quite a few cases is the dreaded 'data retrieval' phase. During said phase, the app will go into a state of nothingness whilst the data is retrieved, at which point it'll come back and be useable again. Now, we all know the way to keep the UI active is to multi-thread that bad boy, and that's where I'm at. In the app I'm thinking of, whilst...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Dispose of a WPF UserControl (ish)

I've been playing with WPF a little bit, and quite frankly got a bit stuck, (Meh! Who'd have thought). The problem is as follows: I create a UserControl - we'll call it 'MyUserControl' (wouldn't want to break traditions now would we). In said user control I have a button, that when pressed will fire off a new thread. This new thread will (say) poll a file / service - whatever - every 10 seconds or so, and update a Label accordingly. When I close the app, if the app is polling, then the app won't...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

RoundedButton Button Style (WPF)

So far, I have only one style which I'm currently using on all my buttons, and to be honest, I'm still working on it, but it's been in a pretty stable state of development for a while now, so I thought I'd share it. Let me introduce you to the imaginatively titled: RoundedButton. The above picture shows 3 buttons, the first (top-most) is the bog standard WPF button, no styles applied. <Button Height="30" Width="100" Margin="20">Normal Button</Button> The second two are RoundedButton styled,...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati