Welcome to MSDN Blogs Sign in | Join | Help

Lester's WPF blog


Simple, easy & beautiful

News

WPF Localization Guidance Doc

Localization of WPF apps has always been a tricky issue... Theres now a loc doc that can help you in localizing your apps. Its a pretty long doc but is very informational. Do read it and provide feedback.

http://wpflocalization.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=29389

Share this post

 

System.Xaml: Method calls from Xaml

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

Share this post

 

Bing goes Live!!

You can now search using Bing.

For Tips and Tricks using Bing, follow this link

Share this post

 

WF\WPF sample using System.Xaml

Check out the WF/WPF integraion sample using the System.Xaml stack. "The sample demonstrates how to create an application that uses Windows Presentation Foundation (WPF) and Windows Workflow Foundation (WF) features in a single XAML document. To accomplish this, the sample uses Windows Workflow Foundation (WF) and XAML extensibility."

To download the sample, click here

Share this post

 

Download VS2010\.NET Framework 4.0

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

Share this post

 

Download M-V-VM Project Template/Toolkit

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

Share this post

 

TestAPI v0.2 Released

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 :) )

 

Share this post

 

Navigation system in WPF

Recently, Tamir revealed an in-car assistant system having a WPF GUI.

 

Thats how a navigation system should look like.. I want one :)

Share this post

 

GeoPlaces: WCF\WPF app

GeoPlaces - This is a pretty cool app integrating several texhnologies - WPF/WCF/ADO/Virtual Earth API.

The source code is on code project - so get your hands dirty with this code :)

 

Share this post
ViewModels in MVVM: CLR objects vs. DependencyObjects

Came across Kents post on this topic that provides a strong case for the use of CLR objects for view Models. The post is on the longer side but is an interesting read. :) ... Good one to read in your coffee break.

LINK

Share this post

 

IE8 Released : Try it Out!

So IE8 was released today and I got it up and running on my machine. It works really well and if you havent tried it you gotta get it now. It makes the browsing experience a really pleasant one.

its got a lot of new features (check this link).. notable among these are the accelators, web slices, inPrivate browsing, smartscreen filters ....

Download link

Share this post

 

MVVM Screencasts

If you are interested in using MVVM architecture for your applications you should defintely take a look at the screencasts made available on Josh's site.

 Implementing Model-View-ViewModel in WPF

Implementing Model-View-ViewModel in Silverlight

Implementing MVVM & Exploring UX Design Patterns

Share this post

 

WPF App: Sonic

Did you check out Sonic... Its a pretty complex mp3 player by Sacha that "allows the users to specify the users music location(s) (Via App.Config) and then use some funky LINQ/IQueryProvider magic to work out what MP3s are available, and the use the ID3 tag information to store the file metadata in SQL"

Share this post

 

DataBinding CheatSheet

Rob earlier sent a mail about the DataBinding cheat sheet. It did look pretty comprehensive :)... You can get the pdf or go to the original post here

A small snapshot

Share this post

 

TestAPI Library Usage

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() });

c.Execute();

 

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

 

Share this post

 

More Posts Next page »
Page view tracker