Quick Tip: LINQ & Data Binding notifications

June 23, 2009

In Silverlight & WPF we could databind to the LINQ query results: private ObservableCollection<string> someData = new ObservableCollection<string>(); //Somewhere in code someData.Add("Alex"); someData.Add("Alen"); someData.Add("Josh"); someData.Add("Brad"); var res = from data in someData            where data.StartsWith("A")            select data; listbox.ItemsSource = res; ”listbox” is the name of the Listbox on my XAML page. When application will load we will get expected results: But what happens when out collection (reminder: ObservableCollection, which implements INotifyCollectionChanged) changed? someData.Add("Antony"); Nothing! Because we bounded to the LINQ query (predicate), and the query was executed...

Silverlight 3 Quick Tip #10: Styling Improvements

June 22, 2009

Silverlight 3 bring long-awaited improvements in styling mechanism: “BasedOn” mechanism, Merged Resource Dictionaries and eliminates “write once” style setting behavior. Let’s see those features. BasedOn Styles can be “derived” from one another. Perfect for cascading/inheriting styles. Let’s define style for a… Button (well, in demos it is always a Button, TextBox, etc. ;)) <Style x:Key="BaseButtonStyle" TargetType="ButtonBase"> <Setter Property="Width" Value="100"/> <Setter Property="Height" Value="25"/> <Setter Property="Margin" Value="5"/> </Style> To “derive” from existing style we should specify BasedOn property <Style x:Key="DerivedButtonStyle" TargetType="ButtonBase" BasedOn="{StaticResource BaseButtonStyle}"> ...

Silverlight 3 Quick Tip #9: DataBinding with Validation

June 21, 2009

Silverlight 3 provides validation mechanism while using Two-Way data binding. Silverlight 3 also provides default a Validation Exception UI – callout with exception details, which could be customized. Many input-related controls such as TextBox, CheckBox, etc. have built-in support for validation. How to use? Simple, like everything with Silverlight: To enable validation, use the ValidatesOnExceptions property. <TextBox Text="{Binding ID, Mode=TwoWay, ValidatesOnExceptions=True}" /> //Code behind – property definitionpublic string ID { get { return id; } ...

Silverlight 3 Quick Tip #8: Caret Brush

I love an ability to change the standard look and feel of the controls in Silverlight. I like “dark” themes for my applications :) While working with Silverlight 2, many times I’ve found myself with very strange UX – my very nice black themed application with white texts confuses users… Where is the caret in this text box? What if user want to fix something, how does he/she knows where to type… One of nice additions in Silverlight 3 was an ability to change the color of the TextBox Caret. Now TextBox...

Silverlight 2 applications: a day after Silverlight 3 release

June 16, 2009

Silverlight 3 release date is approaching, and I’m getting questions what will happen to existing Silverlight 2 applications after it will be released. Also I’m getting questions about the runtime version upgrade. Let’s see what will happen after Silverlight 3 will be released… Those who already using Silverlight 2 and getting automatic updates will receive the new runtime automatically. Everyone else need to download and install it manually. The updated clients will be able to run Silverlight 2 applications as it was before the runtime update. It is possible because of “quirk mode change” –...

What’s new in Silverlight 3 and Expression Blend 3 – DevDay (22 July 2009)

June 9, 2009

Silverlight 3 will be released very soon. Many new features were added, many improvements were made. Come and see me presenting what’s new in Silverlight 3 and Expression Blend 3 at Microsoft Israel Offices, 22 July 2009. I will talk about new features, new and improved technologies. Will see Silverlight 3 tools and features in current version of Visual Studio 2008 and in upcoming release of Visual Studio 2010 (Beta). Will see what’s new in Expression Blend 3. Many cool demos, tips & tricks are promised!!! :) Details and Registration ...