Nov
12
2010
I’ve received several requests about the modalities of enabling multi-touch on a UI element using the Behavior available on my CodePlex project.
The traditional syntax using XAML is here:
<Image Source="Images/Desert.jpg" x:Name="image1">
<interactivity:Interaction.Behaviors>
<Silverlight4:MultiTouchBehavior
IsInertiaEnabled="True"
IsTranslateXEnabled="True"
IsTranslateYEnabled="True"
IsRotateEnabled="True"
IsScaleEnabled="True"
MinimumScale="10" MaximumScale="100"
AreFingersVisible="True"/>
</interactivity:Interaction.Behaviors>
</Image>
What about if you want to achieve the same result using C#? Just obtain a collection of behaviors for your element and then add/remove the MultiTouchBehavior using the following syntax:
private void btnAttach_Click(object sender, RoutedEventArgs e)
{
var behaviors =
System.Windows.Interactivity
.Interaction.GetBehaviors(image1);
behaviors.Clear();
var mtb = new MultiTouchBehavior
{
IsRotateEnabled = true,
IsScaleEnabled = true,
IsTranslateXEnabled = true,
IsInertiaEnabled = true,
AreFingersVisible = true,
MinimumScale = 20,
MaximumScale = 200
};
behaviors.Add(mtb);
mtb.Move(new Point(200, 150), 45, 100);
}
private void btnDetach_Click(object sender, RoutedEventArgs e)
{
var behaviors =
System.Windows.Interactivity
.Interaction.GetBehaviors(image1);
if (behaviors.Count > 0)
{
behaviors.Clear();
}
}
As usually the source code is available for download on the Multi-Touch CodePlex project (check out the SilverlightWP7MultiTouch Solution).
Oh, did I already say that it also works on Windows Phone 7?
Happy Silverlighting!
no comments | tags: .NET, Expression, Multi-Touch, Programming, Silverlight 4, UX, Windows Phone | posted in .NET Programming, New Technology, Programming, Rich Internet Applications, UX - Design
Oct
4
2010
Check out this great resource for MEF (Managed Extensibility Framework developers:

From the main site:
MefContrib is a community-developed set of extensions, tools and samples for the Managed Extensibility Framework (MEF).
The project is an open source project, licensed under the MS-PL license. MefContrib is about YOU. With your help we can make it a vibrant resource for MEF developers world-wide.
MEF Contrib is the one stop shop for all your MEF needs. Within you’ll find:
- Community extensions to MEF like support for convention based registration, open generics and AOP.
- Tools like Visual MEFX, a tool for diagnosing composition
- Guidance, Quickstarts and Samples to help you learn the ropes from experts
no comments | tags: .NET, .NET Programming, Patterns, Programming | posted in .NET Programming, News, Programming
Apr
12
2010
“The Microsoft Surface Toolkit for Windows Touch Beta is a set of controls, APIs, templates, sample applications and documentation currently available for Surface developers.
With the .NET Framework 4.0, Windows Presentation Framework 4.0 (WPF), and this toolkit, Windows Touch developers can quickly and consistently create advanced multitouch applications for Windows Touch PCs.
This toolkit also provides a jump-start for Surface application developers to prepare for the next version of Microsoft Surface. Use it to take advantage of the innovative Surface technology and user interface to develop your own rich and intuitive multitouch experiences for a variety of Windows Touch devices.”
Links:
Enjoy!
1 comment | tags: .NET, .NET Programming, Multi-Touch, New Technology, Surface, WPF | posted in .NET Programming, New Technology, News, Programming, UX - Design
Jan
7
2010
I’ve updated the behavior available in the Expression Community gallery adding Multi-Touch manipulation (translation, rotation and zoom) and inertia effects using code from the Surface Manipulations and Inertia Sample for Microsoft Silverlight.
To enable Multi-Touch in your code simply download the behavior from here, add the project “MultiTouch.Behaviors.Silverlight” to a Visual Studio solution and then enable the gestures in XAML:
<UserControl x:Class="SilverlightMultiTouch.MainPage"
...
xmlns:interactivity="clr-namespace:System.Windows.Interactivity; assembly=System.Windows.Interactivity"
xmlns:behaviors="clr-namespace:MultiTouch.Behaviors.Silverlight; assembly=MultiTouch.Behaviors.Silverlight"
...
>
<Canvas>
<Image Source="Images/Desert.jpg">
<interactivity:Interaction.Behaviors>
<behaviors:MultiTouchManipulationBehavior InertiaEnabled="True" TouchRotateEnabled="True" TouchTranslateEnabled="True" TouchScaleEnabled="True"/>
</interactivity:Interaction.Behaviors>
</Image>
<Image Source="Images/Jellyfish.jpg">
<interactivity:Interaction.Behaviors>
<behaviors:MultiTouchManipulationBehavior InertiaEnabled="True" TouchRotateEnabled="True" TouchTranslateEnabled="True" TouchScaleEnabled="True"/>
</interactivity:Interaction.Behaviors>
</Image>
</Canvas>
The MultiTouchManipulationBehavior also contains some dependency properties (TouchRotateEnabled, TouchTranslateEnabled, TouchScaleEnabled and InertiaEnabled) to enable the corresponding gestures.
The example contains Multi-Touch manipulations applied to some Image controls and a Smooth streaming player of the Silverlight Media Framework.

I’ve also posted to CodePlex a sample using WPF 4 based on the article “Introduction to WPF 4 Multitouch“ by Jaime Rodriguez.
Hope this helps and Happy Silverlighting!
15 comments | tags: .NET, .NET Programming, Multi-Touch, New Technology, Silverlight 3, Silverlight 4, UX, WPF | posted in .NET Programming, New Technology, Programming, Rich Internet Applications, UX - Design
Oct
19
2009
Lot of news this week!
Visual Studio 2010 and .NET Framework 4 Beta 2 are now available for download here, Jeff Beehler has posted some useful info about this “go live” release.
The new Silverlight Toolkit October 2009 Release is also available on Codeplex featuring Visual Studio 2010 support and various improvements on existing components (like drag-and-drop for items controls).
Read these posts by Tim Heuer and Jeff Wilcox for more details and enjoy!
2 comments | tags: .NET, .NET Programming, C#, F#, Programming, Silverlight 3, Visual Studio, WPF, XAML | posted in .NET Programming, News, Programming, Rich Internet Applications
Feb
3
2009
Click here to read the future plans for Delphi Prism, by Nick Hodges.
no comments | tags: .NET, .NET Programming, Delphi, Linux, Open Source, WCF, WPF | posted in .NET Programming, Delphi, Linux and Open Source, Programming, Rich Internet Applications
Jul
2
2008
Thanks to this post by Marco Cantù, I’ve found two interesting articles by Justin James about the future of the Embarcadero/CodeGear development environments:
Justin states that ”CodeGear’s .NET products are expanding in new directions, which include RIA development and targeting other platforms (through systems such as Mono)”.
Will we be able to write rich internet applications using Delphi and targeting both .NET and Mono platforms?
no comments | tags: .NET, Delphi, Open Source, PHP, Ruby | posted in .NET Programming, Delphi, Linux and Open Source, PHP, Rich Internet Applications, Ruby