Microsoft released the first beta version of Silverlight 4 on 18th November 2009 at PDC in Los Angels. This version has been released for the developers only to have a look on what they are actually featuring on Silverlight 4 final release. As it’s not a Go-Live version hence you can’t develop commercial application using it. The Silverlight 4 runtime is not available for the end user till now.

Silverlight 4 Beta 1 comes up with a lot of powerful capabilities as already requested by the developers. Microsoft shipped it with almost 90% of requested features. You can see the list of new features in “What's new in Silverlight 4?

To develop Silverlight 4 application you will need Visual Studio 2010 beta 2 which you can download it from “Get Tools” section. All necessary links are available on that page. Microsoft also released the new Expression Blend & the new Silverlight Toolkit for Silverlight 4 Beta 1. You can download them from the same location.

Have a look into Tim Heuer's Blog for more details.

Published by on under News | Silverlight

Silverlight 3 came up with Out Of Browser support. Using that feature one can install the application just like a standalone windows application. Hence no need to open the browser to run the Silverlight application. Today for the first time I gone thru the APIs & created a sample application. Here I will discuss about the same to give you a demonstration. It is quite easy to implement.

Create a Silverlight application using Visual Studio 2008. This will automatically create “MainPage.xaml”. Now open the MainPage.xaml & add the following lines inside the LayoutRoot Grid:

<StackPanel Margin="20" HorizontalAlignment="Center">
<
TextBlock Text="Silverlight Out Of Browser Demo Application"
FontSize="20" HorizontalAlignment="Center"/>
<
Button x:Name="btnInstall" Content="Install as Out Of Browser Application"
Width="300" Height="20" Margin="20"/>
</StackPanel>

Read the Complete Article @ DotNetFunda.com

Published by on under .Net | Silverlight

Microsoft released their all new Operating System as expected. From now onwards it is available for the general public i.e. you can purchase a new PC/Laptop with Windows 7 preloaded. Not only this, those who recently purchased PC/Laptop with Windows Vista they are able to upgrade to Windows 7 free of charge. So, grab your copy now & enjoy the real experience with Windows 7.

For last couple of months I am using the trial edition of Windows 7. According to me, it is a great operating system Microsoft had ever launched with lots of goodies. My special thanks to Microsoft & Windows 7 team for their excellent work.

No doubt this is really a great Microsoft Operating System with a huge performance boost, a great UI, new taskbar & multi-touch function. Here are the list of things I liked more in Windows 7:

  • A great new Graphical User Interface
  • The all new Taskbar & Taskbar thumbnails panel
  • The new Taskbar Jump List
  • A huge performance boost than the earlier operating systems
  • Multi-touch capability
  • The latest User Account Control, which is now a great experience rather than Vista
  • Scheduled Desktop Wallpaper changer & Theme support
  • New kernel dumping methods which actually improved the performance
  • The new control panel, device manager & user libraries
  • And more…

It’s definitely a great ERA in the computing world.

Published by on under News | Windows7

It’s a great day in the Microsoft era. They are going to launch the official release of Windows 7 today. From now onwards, this will be available to purchase all over the world.

You can view the Windows 7 Launch celebration here directly from New York city, which will be hosted by Steve Ballmer. This will start at 8 AM (Pacific) / 11 AM (Eastern).

Published by on under News | Windows7

Microsoft has just released it’s October 2009 release of Silverlight 3 Toolkit. You can download it from: Silverlight 3 Toolkit October 2009 Installer. Also have a look into the sample application at: Silverlight 3 Toolkit Sample Application

Silverlight 3 Toolkit has now full design time supports for Visual Studio 2010. Charting tool has been changed. They now introduced ISeries interface as the base interface for all the Series & StylePalette now renamed to Palette. So, those who are using StylePalette just make those changes in your code. You can now customize the LegendItem very easily. Silverlight team now added the support to Themes for Accordion, DataForm, DataPager, GridSplitter & ChildWindow. Added support for Drag & Drop functionality for some common items like ListBox, TreeView, DataGrid and Charting tools. Moreover the mousewheel support has been now added to navigate the GlobalCalendar & TimePicker controls.

Have a look into those latest features of Silverlight 3 Toolkit. In real scenarios those are really very awesome features. Though it is their 5th release of Silverlight Toolkit, hope they will come up with lots of required controls in the future versions.

Published by on under .Net | News

In my last post Windows 7 Multitouch Application Development (Part - I), I described about how to handle multitouch image manipulation in Windows 7 which gives a very basic idea on the multitouch development. That code uses multitouch manipulation for the entire screen. If there are multiple images in the screen this will raise event for all.

image In this post, I will show you how to manage multitouch events for all the images separately. See one of such kind of image manipulation demo here.

For this we have to assign a unique touch-id for each finger on the screen. As long as the finger touches the screen the associated touch-id will remain same for that particular finger. If the user releases his finger the system will release the touch-id & that can be again assign by the system automatically on next touch. So, how can we get the touch-id? You can get the same from the StylusEventArgs (i.e. args.StylusDevice.Id). The stylus device will automatically generate this ID for each touch, only thing is you have to assign it with the respective finger touch.

First of all, we will create an UserControl which will consist of a single Image & XAML code for it’s RenderTransform. The same thing we did in the previous post which was inside the Window, but here it will be inside the UserControl (Picture class). Create a DependencyProperty to assign the ImageLocation dynamically.

<UserControl x:Class="Windows7MultitouchDemo.Picture"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Image Source="{Binding Path=ImageLocation}" Stretch="Fill" Width="Auto"
           Height="Auto"  RenderTransformOrigin="0.5, 0.5">
        <Image.RenderTransform>
            <TransformGroup>
                <RotateTransform x:Name="trRotate"/>
                <ScaleTransform x:Name="trScale"/>
                <TranslateTransform x:Name="trTranslate"/>
            </TransformGroup>
        </Image.RenderTransform>
    </Image>
</UserControl>

To track the multi-touch simultaneously for the above “Picture” usercontrol, you can use the PictureTracker class which comes with the Windows 7 Training Kit. You can download it from Microsoft Site. It looks similar to this:

/// <summary>
/// Track a single picture
/// </summary>
public class PictureTracker
{
       private Point _prevLocation;
       public Picture Picture { get; set; }
       public void ProcessDown(Point location)
       {
           _prevLocation = location;
       }
       public void ProcessMove(Point location)
       {
           Picture.X += location.X - _prevLocation.X;
           Picture.Y += location.Y - _prevLocation.Y;
           _prevLocation = location;
       }
       public void ProcessUp(Point location)
       {
           //Do Nothing, We might have another touch-id that is
           //still down
       }
}

Now, we have to store all the active touch-ids associated with the PictureTracker class. So, we will use a dictionary for that. We will use the same PictureTrackerManager class which again comes with the Windows 7 Training Kit.

private readonly Dictionary<int, PictureTracker> _pictureTrackerMap;
Create an instance of the PictureTrackerManager class inside your Window1.xaml.cs & register the stylus events with the PictureTrackerManager events. So now whenever a touch occurs on the Picture, the PictureTrackerManager will first find the associated touch-id for the respective instance and raise event to process the same.
//Register for stylus (touch) events
StylusDown += _pictureTrackerManager.ProcessDown;
StylusUp += _pictureTrackerManager.ProcessUp;
StylusMove += _pictureTrackerManager.ProcessMove;
Reference:  Windows 7 Training Kit
Download Sample Application

Published by on under .Net | Tips
Microsoft is going to launch the new Windows 7 operating system in October 2009. Currently the RC version is available online. As you know, Windows 7 came up with lots of goodies including better resource management, better performance, jumplist management, multitouch functionality & many more. Here I will discuss on developing a simple multitouch application using .Net 3.5 SP1.

Before doing anything you have to download the Windows 7 Multitouch API. You can download it from here. Extract the downloaded zip file to your local hard drive. Be sure that, you are using Windows 7 & you have a multitouch enabled screen to test it out.

Create a WPF application using Visual Studio 2008. This will automatically add a XAML file named Window1.xaml for you. Now add an image to your solution directory & insert it in the XAML. Now your Window1.xaml will look something like this:

<Grid>
    <Image Source="images/Hydrangeas.jpg"/>
</Grid>
Add RenderTransform to the image so that, we can scale or rotate the image properly. This will produce XAML similar to this:
<Grid>
    <Image Source="images/Hydrangeas.jpg" RenderTransformOrigin="0.5,0.5" Width="400">
        <Image.RenderTransform>
            <TransformGroup>
                <ScaleTransform x:Name="trScale" ScaleX="1" ScaleY="1"/>
                <RotateTransform x:Name="trRotate" Angle="0"/>
                <TranslateTransform x:Name="trTranslate" X="0" Y="0"/>
                <SkewTransform AngleX="0" AngleY="0"/>
            </TransformGroup>
        </Image.RenderTransform>
    </Image>
</Grid>
Use proper names when you are adding different types of transform to the transform group. It will be easier for you to handle it from the code behind file. Run your application. This will open up your Window with an image inside it. If you want to drag or rotate the image this will not work because we haven’t integrated the functionality yet. Add two project references i.e. “Windows7.Multitouch” & “Windows7.Multitouch.WPF” from the extracted zip folder to your solution. These are the managed API codes for multitouch application development. Go to your Window1.xaml.cs & be sure that following namespaces are already included. You may have to add some of them.
using System; 
using System.Windows; 
using Windows7.Multitouch; 
using Windows7.Multitouch.Manipulation; 
using Windows7.Multitouch.WPF; 
Create two private members inside your partial class:
// object of a .Net Wrapper class for processing multitouch manipulation 
private ManipulationProcessor manipulationProcessor = new ManipulationProcessor(ProcessorManipulations.ALL);

// boolean value to check whether you have a multitouch enabled screen 
private static bool IsMultitouchEnabled = TouchHandler.DigitizerCapabilities.IsMultiTouchReady;
Now inside the Window Loaded event write the following lines of code:
// check to see whether multitouch is enabled 
if (IsMultitouchEnabled) 
{ 
    // enables stylus events for processor manipulation 
    Factory.EnableStylusEvents(this); 

    // add the stylus events 
    StylusDown += (s, e) => 
    { 
        manipulationProcessor.ProcessDown((uint)e.StylusDevice.Id, e.GetPosition(this).ToDrawingPointF()); 
    }; 
    StylusUp += (s, e) => 
    { 
        manipulationProcessor.ProcessUp((uint)e.StylusDevice.Id, e.GetPosition(this).ToDrawingPointF()); 
    }; 
    StylusMove += (s, e) => 
    { 
        manipulationProcessor.ProcessMove((uint)e.StylusDevice.Id, e.GetPosition(this).ToDrawingPointF()); 
    }; 

    // register the ManipulationDelta event with the manipulation processor 
    manipulationProcessor.ManipulationDelta += ProcessManipulationDelta; 

    // set the rotation angle for single finger manipulation 
    manipulationProcessor.PivotRadius = 2; 
}
Write your logic inside the manipulation event handler implementation block. Here I will do rotation, scaling & positioning of the image. Here is my code:
private void ProcessManipulationDelta(object sender, ManipulationDeltaEventArgs e)
{
    trTranslate.X += e.TranslationDelta.Width;
    trTranslate.Y += e.TranslationDelta.Height;

    trRotate.Angle += e.RotationDelta * 180 / Math.PI;

    trScale.ScaleX *= e.ScaleDelta;
    trScale.ScaleY *= e.ScaleDelta;
}
From the ManipulationDeltaEventArgs you can get various values & depending upon them you can implement your functionality in this block. TranslateTransform will position the image, RotateTransform will do the rotation & the ScaleTransform will resize the image. Run your project to test your first multitouch application.
Download Sample Application
Published by on under .Net | Tips
While working in Windows you have seen that, while focusing on any TextBox the entire text inside it has been selected. This is a default behaviour of Windows, but in WPF this behaviour is not present. For this you have to write code.

If you want to add the same behaviour in your WPF application then you have to register the TextBox.GotFocus event for each textbox inside your Window and in that event implementation you have to write the code to select all the text inside the focused TextBox, right? If you do like this, then you have to write so many event registration for each one of the TextBox.

 

 

Lets say, you have a single Window with 100 TextBoxs in it. In this case though you can write the event definition inside a single implementation but you have to register the event for 100 times. Now imagine the same behaviour for 10 Windows inside the same application. Here you have to write the event implementation for each and every Window & register the event for each TextBox. This will definately clutter your code.

So, how can you get the said behaviour in your WPF application? It is a simple trick inside your App.xaml.cs file. This will be a global event handler for any TextBox in your application. If you open your App.xaml.cs you will find a overridable method named "OnStartUp". Inside this register the TextBox.GotFocus event for every TextBox before calling the OnStartup method for the base class. After doing this trick, your OnStartup method will look like this:

 

 

protected override void OnStartup(StartupEventArgs e)
{
    EventManager.RegisterClassHandler(typeof(TextBox), TextBox.GotFocusEvent, new RoutedEventHandler(TextBox_GotFocus));
    base.OnStartup(e);
}

Here, the EventManager class will be responsible to register the event handler for all TextBox. So simple right? Now add the event handler implementation for the TextBox in the same class. This will look like this:
private void TextBox_GotFocus(object sender, RoutedEventArgs e)
{
    TextBox tb = sender as TextBox;
    tb.Focus();
    tb.SelectAll();
}  
             
Now run your application with multiple Windows having multiple TextBox on them. Focus on any TextBox having some texts inside it. You will see the same behaviour has been added to all of your TextBox.
Published by on under Tips | WPF
MoXAML is an AddIn for Visual Studio to make your coding more productive for WPF and Silverlight Applications. By using this great power toy, you can code without giving more efforts. It has lots of features like beautifying the XAML code, Keyword Lookup, better comment support for XAML, automated Dependency Property creation and more.

You can also explore the features of XAML Power Toys. This will give you a extended power to design your XAML. This is really a good AddIn not only for the designers but also for the developers. You can create your ViewModel class, create ListView or Form for selected class, extract properties to style, option to generate x:Name for controls, grouping controls inside GroupBox and lots of other goodies. Check out the site for the latest features.

Mole is a tool that integrates with Visual Studio which lets you inspect the Visual Tree of your application, view and edit properties or data, view the XAML for selected elements and more. It allows unlimited drilling to objects and sub objects.

Snoop is a tool which you can use to hook to your running WPF application and browse the Visual Tree of the application. You can also inspect and edit the properties, inspect routed events and magnify sections in the UI and also debug binding errors.

Crack.Net is a runtime debugging tool for .Net desktop applications (both WPF & WinForms) just like Mole & Snoop. It allows you to go thru the managed heap of another .Net application, view all kinds of values on different objects and also manipulate them easily. You can also read the Crack.Net article.
Published by on under .Net | Silverlight
Microsoft released Silverlight 3 on 10th July 2009 as per the schedule. You can download the SDK, Visual Studio Tools & Blend from the following location:
Silverlight 3 came with the following features:
  • Out of Browser support
  • Network status check
  • Pixel Shader Effects
  • Bitmap APIs
  • Runtime themeing support
  • Enhanced control skinning
  • Support for System Colors
  • Bitmap Caching
  • Perspective 3D view
  • GPU hardware acceleration
  • Text animation
  • H.264 support
  • RAW audio/video support
  • Save File Dialogue
  • Wrap Panel, View Box, Dock Panel
  • Support for local fonts
  • Binary XML
  • Component caching & Scene caching
Published by on under .Net | Silverlight