Silverlight 2 Binding Modes Diagram
Monday, June 23 2008 - silverlight, xaml, wpf, book - 2 comments
Here’s a tiny little nugget from my upcoming book. There are always concepts that are just natively drilled into me yet they don’t flow smoothly when I try to explain them. For example take the Silverlight 2 binding modes. You have OneTime, OneWay and TwoWay as options. OneWay is the default and many examples of XAML based binding I see of XAML in both Silverlight and WPF omit the Mode property entirely. But OneTime is not always the appropriate option, either. Read only data is better suited for OneWay while editable data is suited well for TwoWay. Data that should only be bound and displayed when the source is first bound is ideal for OneTime.
There are nuisances to the scenarios, too (aren’t there always?). For example, OneWay and TwoWay bindings rely on the INotifyPropertyChanged interface and its PropertyChanged event being raised.
OK, so my point is that sometimes explaining these types of situations is more difficult than just showing them with code. I;ve always been more about show me the code and sprinkle a little bit of explanation around it. To me that is so much easier to comprehend than reading a dozens of pages without code or pictures.
So I came up with a simple diagram for to help myself explain the binding modes a little bit. Its not the only tool I use (I use code samples, other diagrams, and words too) but its one I start with. I figured I would share it for any who might be interested. You can also find a variation of this diagram in my upcoming book Data Access with Silverlight 2 published by O’Reilly (Dec 2008).
Resharper 4 Beta Released and Downloaded!
Thursday, May 22 2008 - resharper, xaml - 2 comments
I downloaded Resharper 4 beta today. I've been installing several versions of the Resharper 4 EAP as they have been released. Most have been pretty stable over the past month, which makes it no surprise that they released a beta. Yes its a later than most, including myself, expected to see a new version that supports all of the features of .NET 3.5 and Visual Studio 2008 (like LINQ, lambdas, and extension methods) but the EAPs have kept me going. Frankly I have gotten addicted to refactoring tools. Resharper has less eye candy that CodeRush and Refactor Pro, but its more efficient for me.
I'd love to see Developer Express really step up and compete with Resharper on their code analysis and other great aspects. There are some great features from both. But I digress ...
The beta version of Resharper 4 is out, and it supports LINQ and all of the other cool new toys. One thing I love about Resharper is the renaming feature and how it works with XAML. This has been awesome while writing my latest Silverlight projects.
Using the SHIFT - F6 key combination you can rename a variable, class, etc. But you can also do this in XAML and have it update both the XAML and the .NET code in the code behind. I did this below for my sample app where I renamed txtCompanyName to txtAnytext.
But one of the places that really makes Resharper shine for me is when I am writing code for objects and variables that I have not yet created. Now that this works for LINQ, Automatic Properties, and lambdas it makes my life much easier. For example, check out this query I wrote:
List<Person> personList = new List<Person>();personList = GetPersons();
var query = from p in personListwhere p.City.StartsWith("S")
select new {p.FirstName, p.LastName, p.Phone};The Person class does not exist yet nor do the properties for it. Resharper helps create these using some shortcuts, most notably the ALT-ENTER key combination. Using this shortcut on the Person class reference, Resharper first creates the Person class for me. Then I use ALT-ENTER on the property name for City and it gives me this option to create the property:
I can repeat that for the other properties and fill in my class nicely. You can use the F12 key to go to the next "error" in the file. In this case the cursor will jump to the next property that I have not yet defined. So in this code I am basically hitting F12, ALT-ENTER, ENTER,and some TABs to fill in my class and its properties.
public class Person
{public string City { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Phone { get; set; }
}
It will create automatic properties for you or you can have it create regular property getters and setters. For me, I use a live templates to create my field and property combinations.
Anyway, give it a whirl if you have not tried it. Once you get used to some of the most common tools (Find Usages, Code Analysis, renaming, ALT-ENTER, etc.) you probably won't want to get rid of it.
Expression Studio 2 Ready For Download
Friday, May 02 2008 - silverlight, xaml, wpf, expression - 9 comments
Expression Studio 2 is out of beta and has been released. I've been using the betas and they have been pretty good, but its nice to finally get my hands on the full release as v2 is much better than v1.
Expression Studio contains the following products:
- Expression Web 2
- Expression Blend 2
- Expression Design 2
- Expression Media 2
- Expression Encoder 2
Clipped from their web site, here is a list of features for Expression Studio 2:
Design for Windows and the Web
Use a full range of new professional design tools to bring your creativity to the world of the .NET framework and Silverlight. Design the next generation of user interfaces for Windows and the Web.
Designer Developer workflow
Combine Expression Studio for designers with Visual Studio for developers for a powerfully integrated solution for designing and coding innovative applications.
Design for Silverlight 1.0
Expression Studio 2 is the essential design resource for Microsoft's newest web technology Silverlight 1.0 - use a combination of Expression Blend 2 and Design 2 to create your Silverlight application and Expression Web 2 to integrate it into your website.
Standards Based design with Expression Web 2
Design for today's web standards with Expression Web 2, built to translate your visual layouts into fully compliant pages using your choice of versions of XHTML, CSS, XML and XSLT.
Harness the power of ASP.NET and PHP with Expression Web 2
Expression Web 2 is the first web design tool to offer deep support for both ASP.NET 3.5 and PHP which allows designers to collaborate with developers on web projects to make compelling sites.
Design UX with Expression Blend 2
Collaborate with developers to produce applications with great user experience that both look great and function well. Design application skins with interactivity and animation without needing to type a line of code.
Design for XAML
Design graphic elements for Blend and Silverlight and export them in XAML format to retain absolute fidelity through the life of the project. Have confidence that your design lives on.
Create Artwork with Expression Design 2
Create artwork for your desktop and web applications using an exciting drawing tool then either export as XAML or slice your images for the Web.
Manage your design assets with Expression Media 2
Keep track of your graphic and video files using Expression Media, a team asset management tool that lets you sort, keyword and find them with unsurpassed ease.
Encode Video for Silverlight with Expression Encoder 2
Prepare your files for delivery with Silverlight using the Expression Encoder to crop and add markers enabling your websites to interact with your video content.

Email

