Xaml is awesome. I am hearing lot of "yeah"s... So have you tried out the new System.Xaml stack in .NET 4.0. If you havent give it a shot. It new and improved ...
One of the guys on the Xaml team is Shree and I finally got him to write a post on System.Xaml... Bet you'll see more of him. So have fun reading his post below ...
Rob blogged about Referencing a Named Object in XAML2009. It opens up interesting scenarios like using markup extension to call a method on a named object. Yup, you heard it right. Method calls from XAML. But not exactly... You will have to write code to do it J
We are talking about XAML like,
<School
Topper="{Call students.GetTopper}"
>…
where students is a named object and GetTopper is a method on it. To make this work, implement a markup extension called CallExtension. In the ProvideValue method of the markup extension, get a reference to an IXamlNameResolver service provider.
IXamlNameResolver nameResolver = (IXamlNameResolver)serviceProvider.GetService(typeof(IXamlNameResolver));
Name resolver has a Resolve method that looks up a given name in the current namescope. This works fine if this is a backward reference (i.e, CallExtension comes after the named object in xaml). Resolve will return null for a forward reference (i.e, named object comes after CallExtension), as the parser hasn’t seen the name yet. In that case, return the object returned by GetFixupToken as the value of ProvideValue. This tells the parser to call ProvideValue second time once the required name is seen.
object instance = nameResolver.Resolve(parts[0]);
if (instance == null)
{
string[] names = new string[] { parts[0] };
instance = nameResolver.GetFixupToken(names);
return instance;
}
Once you get the named object, you can use reflection to invoke the GetTopper method. Hope you found this post useful.
Attached is the complete project
So we have all been awaiting this... For now, MSDN subscribers can get these downloads here
If you dont have a descrition, its out on Wednesday. WIll put up the links here once they are out. Check the page later :)
The following links will be live after 10 AM PST:
Some snapshots to get you excited while you download :) ... btw, we have been working on the new Xaml stack which comes with this download. So would love to hear feedback



More of these on Jason Zanders blog
Aha!!! Isnt that what we were all waiting for.. You can get this from here
This has been created by the WPF team. So be assured that its good quality...

In addition the toolkit includes:
· A Visual Studio 2008 template (Visual C# Express 2008 also supported)
· Documentation
o General introduction to M-V-VM
o Walkthrough using the VS template
· A complete WPF application demonstrating the MVVM pattern
Got feedback.. Send it to us!! :)
Have fun
TestAPI has released its 0.2 version. New features include:
- App Control API - In the earlier version, automation of the test apps (in proc/out proc) was demo'd in a sample. Now this is integrated into the TestAPI making it simpler to test the apps.
- New Visual Verification Features
- A new tolerance map visual verifier in SnapshotToleranceMapVerifier
- New operations on snapshot (And and Or) allowing you to mask
- A new Snapshot.FromWindow(...) constructor with ability to include and exclude the window chrome in snapshots.
- Improved visual verification internals
- New Command Line Parser features
- xUnit/nUnit Samples - This breaks the dependency on VS to run samples making it easier for people not using VS to see the API in action
- Enhanced documentation
Please check the updated TestAPI. Would greatly appreciate any feedback - (the good as well as the constructive :) )
TestAPI . Heard of it? Tried it?... huh
So here is the gist of it. It’s a collection of helper functions that will make testing your applications easier. Now this is an alpha release and is in the first iteration – so we still have a feature backlog J
Currently we support the following 5 scenarios:
Visual Verification
Sample Usage:
// Capture the actual pixels from the bounds of the screen rectangle
Snapshot actual = Snapshot.FromRectangle(windowRect);
// Load the reference/master data from a previously saved file
Snapshot master =
Snapshot.FromFile(Path.Combine(TestContext.TestDeploymentDir, "Master0.png"));
// Compare the actual image with the master image
Snapshot difference = actual.CompareTo(master);
// Configure the snapshot verifier - It expects a black image with zero tolerances
SnapshotColorVerifier colorVerifier =
new SnapshotColorVerifier(Color.Black, new ColorDifference());
// Evaluate the difference image
VerificationResult result = colorVerifier.Verify(difference);
Input Injection
Includes helpers for mouse and keyboard input
public static class Keyboard
{
public static void Type(string text);
public static void Type(Key key);
public static void Press(Key key);
public static void Release(Key key);
public static void Reset();
}
public static class Mouse
{
public static void Click(MouseButton mouseButton);
public static void DoubleClick(MouseButton mouseButton);
public static void Down(MouseButton mouseButton);
public static void MoveTo(Point point);
public static void Reset();
public static void Scroll(double lines);
private static void SendMouseInput(int x, int y, int data, NativeMethods.SendMouseInputFlags flags);
public static void Up(MouseButton mouseButton);
Dispatcher Helpers
These are simple wrappers around the WPF Dispatcher.
public static class DispatcherOperations
{
public static void WaitFor(TimeSpan time);
public static void WaitFor(DispatcherPriority priority);
CommandLineParser
// Sample for parsing the following command-line:
// Test.exe /verbose /runId=10
// This sample declares a class in which the strongly typed arguments are populated
public class CommandLineArguments
{
bool? Verbose { get; set; }
int? RunId { get; set; }
}
CommandLineArguments a = new CommandLineArguments();
CommandLineParser.ParseArguments(args, a);
// SAMPLE USAGE #2:
// Sample for parsing the following command-line:
// Test.exe run /verbose /id=10
// In this particular case we have an actual command on the command-line (“run”),
// which we want to effectively de-serialize and execute.
public class RunCommand : Command
{
bool? Verbose { get; set; }
int? RunId { get; set; }
public override void Execute()
{
}
}
Command c = CommandLineParser.ParseCommand(args, new Command[] { new RunCommand() });
UIAutomation Helpers
public static class AutomationUtilities
{
// Methods
public static AutomationElement FindElementByIndex(AutomationElement rootElement, int index);
public static AutomationElementCollection FindElements(AutomationElement rootElement, params Condition[] conditions);
public static AutomationElementCollection FindElementsByClassName(AutomationElement rootElement, string className);
public static AutomationElementCollection FindElementsByControlType(AutomationElement rootElement, ControlType controlType);
public static AutomationElementCollection FindElementsById(AutomationElement rootElement, string automationId);
public static AutomationElementCollection FindElementsByName(AutomationElement rootElement, string name);
Since this is still in development we are open to feature requests and will implement them based on the most requested. So do give us feedback. Site: http://www.codeplex.com/TestApi