Skip to main content

Posts

Showing posts from July, 2012

Category & sub-category combo boxes

I was asked the other week how I'd implement a view-model that binds to two combo boxes in the view, where a selection in one affects the other. I've called it category & sub-category combo boxes but I guess it could also be called parent-child combo boxes. Now I don't perceive this as particularly complex to do, but I was asked how would I do it? Would I use two seperate lists and how would I avoid stack overflow exceptions when raising property changed events. The UI looks like this: The categories are represented by the top combo box: The sub categories are represented by the bottom combo box: You should be able to infer from the screen shots that each category has a set of sub-categories, the only special category is All - when selected then all sub categories are displayed, as shown above. So when Category A is selected then only the related sub-categories should be displayed: I used a dictionary &  linq to achieve the behaviour required...

CallerMemberName not that great for INotifyPropertyChanged

I've blogged before about the perf improvements of using the CallerMemberName attribute over an expression tree to avoid using hard-coded property strings names when firing the PropertyChanged event on INotifyPropertyChanged. This works great for the majority  simple cases. Setting the property &  notifying :  or just notifying: The problem is when it's not the simple case - when setting a property on a view model and wanting to force the updating of another property (on the view model) it doesn't work obviously. At this point I'm thinking I'll go back to the expression tree approach.

No GetEntryAssembly in Silverlight!

Ran into a problem today, wanting to get the assembly that started the an application. Now this isn't a tricky problem just had to bend it to my will :) We have a code-base shared across platforms (WPF & Silverlight) via project linker  and we need the ability to get the executable assembly, MSDN describes this as 't he assembly that is the process executable in the default application domain ' ans this is accessed via the  GetEntryAssembly method. The problem is purely because GetEntryAssembly is not supported in Silverlight so we had to come up with away to get the assembly version of the startup dll in the Silverlight XAP. The following code is contained in a library (framework) assembly which know nothing about which assembly (executable) was loaded into the default application domain. So I came up with the idea of using the Application.Current property:

Being featured in windows phone marketplace

I was looking at the download figures for FINDaPAD in the windows phone marketplace today and noticed another spike in downloads on the 26th of June, it had the  same pattern as the spike on the 20th of May. Why are we getting such high downloads on these days? Normally we get a much more modest download rate, 150 per month - not bad a for free app only targeting the UK marketplace: The only reason I can think of is - we've been featured twice in the windows phone marketplace. It would kind of make sense as the second peak is considerably smaller than the first indicating a subsequent placement in the marketplace. It would have been nice to get some heads-up before being featured, even if it's only for personal vanity :) So if you want to get your app featured in the marketplace make sure you complete all the artwork requirements. These can be updated at any time: