What is the easiest way to set spacing between items in StackPanel?

יום ראשון, מאי 29, 2011

What is the easiest way to set spacing between items in StackPanel or any other Panel? Seems like an easy question, but most of the time it requires just too much xaml work. If we’re just putting items of the same type, we can use “anonymous” styles, like so: 1: <StackPanel> 2: <StackPanel.Resources> 3: <Style TargetType="Button"> ...
5 תגובות

Faking Forms Authentication in Silverlight

יום שלישי, פברואר 15, 2011

In a website that implements Forms Authentication Silverlight fits in very easily – Forms Authentication leaves a cookie on the client – and Silverlight just picks it off if you’re using the Browser Stack (which you normally would). In other words – It simply works. However, many times you would like to do the authentication yourself – that is – to fake an HTTP Post so that you can authenticate to a server without having the user actually fill the form and submit it – you’d like to do it programmatically in Silverlight. My first thought was...
תגיות: , ,
אין תגובות

MVVM: How to show a dialog box from the ViewModel using Behaviors

יום ראשון, פברואר 6, 2011

Behaviors seems like the killer feature for every possible problem we used to have with MVVM. Thank god for WPF4 Showing a Message Box is one of those navigational problems that comes with MVVM. It’s something that we want the ViewModel to control, but yet we don’t want the ViewModel to contain any hard reference to the View. My solution uses the Messenger class from MVVMLight toolkit, but can easily be adjusted to use Prism’s EventAggregator. Lauren Bugnion suggested a solution a while ago which is to send a message to the view’s CodeBehind,...
תגיות: , , ,
18 תגובות

fix: SatisfyImports not working correctly in Prism over MEF

יום שישי, פברואר 4, 2011

I’m working on a Silverlight project under Prism/MEF, and that’s the first time I’m using MEF and not Unity in Prism. Resolving dependencies works a bit differently with MEF, and so when I tried to resolve IRegionManager in a ViewModel class my first instinct was to do the following: 1: 2: public IRegionManager regionManager; 3:  4: public ViewModelConstructor() 5: { ...
אין תגובות

Mef or Unity?

יום שלישי, ינואר 25, 2011

  MEF or Unity? Recently I started developing a new Silverlight LOB project which required the assistance of Prism (now that it reached v4 and actually works fairly ok with MVVM I’m using it more often). Prism now supports both Unity and MEF, and very actively refuses to take sides.. MEF and Unity are similar in many ways, and many people like to think of MEF as yet another IOC Container. Although this line of thought helps us to see the big-picture, it is a bit wrong; MEF is targeted mainly toward composition,...
תגובה אחת

Adapting Silverlight Navigation to MVVM

  Adapting Silverlight Navigation to MVVM The Navigation feature in Silverlight is pretty awesome. It adds support for two very critical issues: 1. Real web-compliancy (Browser Address changes, which adds support for: SEO, Deep Linking, Browser Journal) 2. View-Switching navigation (switching views easily to solve the ever-lasting navigation problem) It’s important to notice that these two issues are actually completely different problems, which for some reason were bundled together! Many times you would want to switch views in different scenarios, but you might not want to change the Url, and even more often...

.Net User Group lecture–MVVM & Blendability

יום חמישי, נובמבר 18, 2010

Thanks for everyone that have participated in my MVVM lecture in the .Net User Group yesterday at Microsoft – I really had fun, and was a pleasure to meet so many smart & interesting people The code that I showed during the presentation, and the presentation itself can be downloaded from my SkyDrive. Thanks again for Jackie Goldstein and Microsoft for organizing the event – I’m looking forward for the next time!
תגובה אחת

Freezable objects–It’s about thread safety! Parallel computing built in.

I just read Tomer Shamam’s post about Christian Mosers’ post about WPF Performace. Both posts are excellent, and Tomer pointed out something I never knew.. thanks Tomer! Adding my two cents to the issue at hand - Christian is saying that you should freeze Freezable objects (such as Brush, Pen, Geometry etc.) because it helps performance. Which is both very true and oh-so-very-important! (Please make sure that you do it.. it really is important) However, he continues to say that it’s important to do so, so that the system would not need to monitor...
תגיות: , , , , ,
3 תגובות

UI testing for Silverlight!

יום רביעי, נובמבר 17, 2010

Finally it’s here! Earlier this week Feature Pack 2 was released. Also known as Testing Feature Pack (hint: it’s mostly about Testing.. ) Finally – we can actually do UI testing with Silverlight apps – the one thing that always made me feel quizzy when working with Silverlight – not being able to do real testing on EVERYTHING is finally over! We can now record our user behavior and test it like it was supposed to be all along.. and now I can look in the eyes of web developers that are used to CodedUI and...
2 תגובות