Site: http://jeffhandley.com/Default.aspx Link: http://feeds.jeffhandley.com/jeffhandley
by Jeff Handley via Jeff Handley on 11/21/2009 5:40:51 PM
When changes are successfully submitted and you have paging enabled, it’s quite possible that some of the entities that have been edited now belong to a different page. Say for instance you are viewing employees ordered by last name, and you edit one of the employees to change their last name, moving them from Jones to Adams. After submitting changes, what should happen? Should Adams continue to show up on the 6th page, or should the data be refreshed to place everyone where they belong? A f ...
[ read more ]
by Jeff Handley via Jeff Handley on 11/18/2009 6:04:00 PM
During Scott Guthrie’s keynote at PDC09 (starting around 1:28:00), Scott Hanselman presented a demo that highlighted Visual Studio 2010, Silverlight 4, RIA Services, and lots of great new tooling that ties all of these products together. I wanted to show you how you can build the same application using installations that are available today. Machine Setup You’ll need to install Visual Studio 2010 Beta 2 if you haven't already. If you have a previous release of RIA Services already installed, ...
by Jeff Handley via Jeff Handley on 11/16/2009 11:58:29 PM
DomainDataSource has two properties for getting the data out of it: Data and DataView. The Data property is what’s intended for exposure in Binding scenarios, for instance binding a DataGrid to the DomainDataSource. This property is typed very simply as an IEnumerable. The DataView property however is intended to be used for programmatic access to the entities exposed by the DomainDataSource. While the two properties currently return the same collection instance, this might not always be tru ...
by Jeff Handley via Jeff Handley on 11/10/2009 6:33:07 PM
While the DomainDataSource is most often used for loading entire sets of records, it can also be used for loading a single record result. This is a topic I’ve seen a few people talk about, assuming it’s a difficult thing to do, and even creating solutions for a problem that doesn’t exist. I want to dispel the myth here: DomainDataSource can in fact be used to easily bind to a single record result. Let’s create a DomainService that has a method to get the most recent error from the AdventureWo ...
by Jeff Handley via Jeff Handley on 10/17/2009 12:40:34 AM
ASP.NET Dynamic Data introduced the System.ComponentModel.DataAnnotations namespace in .NET 3.5 SP1. The namespace contained a bunch of attributes for applying validation rules to objects and their properties. With the “Alexandria” project (which morphed into .NET RIA Services plus some Silverlight/SDK/Toolkit additions), we were exposing your server-side entities up to your Silverlight client. In doing this, we wanted to preserve your DataAnnotations attributes on the client, which of course ...
by Jeff Handley via Jeff Handley on 8/12/2009 4:10:04 PM
I am one of the proud folks that gets to work on the System.ComponentModel.DataAnnotations assembly. This assembly is used by several products, and it seems more are starting to depend on it. Part of the fun with this assembly is that it exists for both Silverlight (as of Silverlight 3), and the full .NET Framework (as of .NET 3.5 SP1). I am responsible for managing source code sharing of this assembly for the two frameworks; in fact, I’m doing some work today related to this. Phil asked me ...
by Jeff Handley via Jeff Handley on 8/8/2009 2:44:39 AM
Awhile back, I blogged about how Silverlight uses Validation Exceptions, which can cause the debugger to break. I showed how to prevent that from happening, but the solution was less than ideal. Someone named rlodina commented on the post: What about manual adding: System.ComponentModel.DataAnnotation.ValidationException in this list. This comment has been sitting in my inbox for about a week, and I had wanted to follow up on this. Well good gosh, this is easy and it works li ...
by Jeff Handley via Jeff Handley on 7/14/2009 10:45:19 AM
With the .NET RIA Services July 2009 Preview, the DomainDataSource now enables some scenarios that were previously blocked. Most namely, we now allow you to change your current page while there are pending changes in the data. Editing and paging seemed like a common enough scenario that we wanted to enable it, so we’ve done so in the recent drop. There are actually many scenarios opened up right now that we’re reviewing. I’ll be frank: many of the following scenarios are probably doing really ...
by Jeff Handley via Jeff Handley on 7/11/2009 12:05:08 PM
The Birth of QuickSilverlight.Validation Over on the .NET RIA Services forums, “SilverlightRIA” asked about performing asynchronous validation with .NET RIA Services and the Silverlight Toolkit’s DataForm. He wanted to intercept the Commit from the DataForm and invoke his async validation, integrating the results into the DataForm’s validation UI. This was an interesting scenario so I put some time into a solution for it this week. The result is a library that I’m calling QuickSilverlight.Va ...
by Jeff Handley via Jeff Handley on 4/1/2009 5:33:11 PM
With the Silverlight 3 Beta SDK and .NET RIA Services, a lot of people are starting to utilize the System.ComponentModel.DataAnnotations library to add validation metadata to their entities. Something that has tripped up some people is the use of exceptions for validation errors, where Visual Studio breaks with a user unhandled exception. As Keith Jones reported, Silverlight 3 uses exceptions to notify controls when validation has failed. This means that many users will see Visual Studio brea ...
by Jeff Handley via Jeff Handley on 12/12/2008 5:44:32 AM
Earlier this year, I talked about how I hadn’t yet seen the need for using the Custom Controls Everywhere approach in XAML. I said, “Just use the controls you have, apply styles, and attach properties and behaviors. And if you find a case where this falls short, let me know!” Well, today, Rick Strahl had a tweet: What's the best way to provide cell padding in the Silverlight grid control? Apply margins to all cell child controls? To which I replied: Yeah, unfortunately, margins on a ...
by Jeff Handley via Jeff Handley on 11/14/2008 10:22:45 PM
Not long after I joined Microsoft, I was looking at the Silverlight Airlines code sample. I was new to Silverlight, so I used this demo as a way to help learn Silverlight. The demo app is pretty cool, and ScottGu showed it off at Mix, so I had seen it before. I took on an exercise to attempt to add some features to the application, and this helped me learn more about Silverlight. To select a flight, you drag your mouse from one city to another, and then drag over the date range for your t ...
by via Jeff Handley on 10/30/2008 1:15:02 AM
This is something that has bitten me several times, so I thought I’d write it down. Maybe I’ll remember, and maybe I’ll help others when they hit this too. The scenario happens when you want to create a new control that can have a template applied to it. Let’s start with this control definition: 1: using System; 2: using System.Windows.Controls; 3: using System.Windows.Markup; 4: 5: namespace ControlTemplate 6: {
... [ read more ]
by Jeff Handley via Jeff Handley on 10/28/2008 4:58:53 AM
One of the reasons why the ViewModel pattern is so powerful in Silverlight and WPF is because Binding Converters can do so much. As we saw in HelloWorld.ViewModel, a ViewModel can expose a boolean property that is consumed as a Visibility value for controls. This requires some glue to convert the boolean to the necessary enum, and that’s where our VisibilityConverter comes in. If you want to see this in action, go check out the sample code, but here’s how the VisibilityConverter works. In or ...
by Jeff Handley via Jeff Handley on 10/28/2008 3:46:50 AM
I just updated my HelloWorld.ViewModel post from earlier today to include the full source code as well as a running app (and a screen shot). Running app here. Source code here. ...
by Jeff Handley via Jeff Handley on 10/27/2008 6:08:35 PM
A few folks asked me to provide a ViewModel sample of some sort. I thought this was a great idea, since I don’t know that I had seen a straight-forward ViewModel sample yet. So here it is: HelloWorld.ViewModel! Click the image to view the Silverlight sample live. Let’s start out by looking at the code for the ViewModel class, since that’s the file that I authored first. 1: using System; 2: using System.ComponentModel; 3: 4: namespace HelloWorldView ...
by Jeff Handley via Jeff Handley on 10/21/2008 11:31:58 PM
When I was at BIG, I created what I called the Extended MVP pattern. I built a framework that was used on multiple projects for managing the presentation layer as well as validation. I’m still very happy with what I created, and my teams at BIG are still pleased with those applications as well. In fact, I just learned that they were looking into using the pattern within a Silverlight project they’re doing a proof of concept for. I mentioned the ViewModel pattern to them, suggesting they use ...
by Jeff Handley via Jeff Handley on 10/14/2008 7:44:35 AM
Tonight, Silverlight 2 is being released to the web (RTW). This release marks an important milestone for .NET developers, probably more so than most realize. Silverlight 2 provides a browser control that can host .NET assemblies. If you’ve been living under a rock, or if you just haven’t been following the Silverlight story, this is news to you; but chances are, you’ve heard this before. But if this doesn’t make you jump up and down with excitement, then you might need to sit back and really ...
by Jeff Handley via Jeff Handley on 10/9/2008 5:54:18 PM
After I posted about how to regain tab navigation in a popup, Ian commented that the workaround had some flaws. First, he lost intellisense inside the <UserControl> and second, which is more painful, he could not refer to any controls inside the child <UserControl> from the page's code-behind. Well, I found a more suitable workaround. Instead of using a <UserControl> to set the TabNagation, you can use a <ContentControl> instead. Here's the updated workaround code: ...
by Jeff Handley via Jeff Handley on 10/8/2008 4:05:11 AM
One of the approaches I've tried using to combat the PropertyChangedEventHandler nuisance is an extension method on INotifyPropertyChanged. Actually, a pair of them. One accepts a single property name and the other accepts a param array of property names, so that events can be fired for multiple events succinctly. 1: /// <summary> 2: /// Raise the specified PropertyChangedEventHandler for the sender 3: /// and property name, but only when the handler is not nu ...
The content of the postings is owned by the respective author. Silverlight Feeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on Silverlight Feeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.