Monthly Archives: April 2009

evidence nova screencast from Tech Days ’09 available

The screencast from the keynote where our evidence nova Silverlight client was presented is now available.

We cut out our part and you can find it here: http://rnd.glauxsoft.ch/evidenceNovaAtTechDays09

FirstFrame

Thanks to Ronnie Saurenmann form Microsoft. He did a very good presentation of our client (you would be a good evidence evangelist 🙂 )!

Btw: Ronnie shows at the end of his presentation one of the hidden features in evidence nova: “How to kill the huhu“. Have fun.

The original video in full length can be found here: http://blogs.msdn.com/swiss_dpe_team/archive/2009/04/28/microsoft-techdays-09-presentations-available.aspx

Advertisements
Tagged ,

Showcase evidence crm – Avaya Contact Center: The video from the presentation is now available

Last week I had time to edit the screen recordings from the first showcase I did.

The video is available here:

image

http://rnd.glauxsoft.ch/avayashowcase/index.html

Tagged , , ,

Microsoft .NET Innovation Award

Last week, we got an Innovation Award from Microsoft for our Silverlight Client called “evidence nova“.

image

The award was presented at the Tech Days ’09 in Bern (CH).
image 
(http://www.microsoft.com/switzerland/msdn/de/techdays/default.aspx)

What is evidence nova?

evidence nova is a full-frame Silverlight client framework on top of the existing evidence application server. The client framework loads the views (XAML from DB), behaviors and related data from the application server through WCF/IIS. The application server is written in .NET 3.5 too.

image
For more information please see: http://www.evidence.eu

The Award

Here you can see our Award as a Silverlight Deep Zoom Image.
http://rnd.glauxsoft.ch/nova

image
(Please note: there are 4 sub-pictures embedded. Three in the corners of the glass and one above the “i” of evidence.)

The video

To get a first impression about our client concept, you should watch this short video from the “April 2009 Preview” version.

image 
http://rnd.glauxsoft.ch/novashowcase

(Why this movie is in flash? Unfortunately this is a problem in Silverlight 2.0. Videos where the height is greater than 576 or the width wider than 1024 are not played correct. Please see here for more information: http://silverlight.net/forums/t/6019.aspx ).

The live demo

The “April 2009 Preview” version is available as live demo here:

image
http://rnd.glauxsoft.ch/evidenceNovaWeb/index.html

(Username/Password: Demo/demo)

UPDATE: Screencast from Tech Days ’09

The screencast from the keynote where our evidence nova Silverlight client was presented is now available also.

FirstFrame

http://blog.thekieners.com/2009/04/30/evidence-nova-screencast-from-tech-days-09-available/

Tagged , ,

How to enable mouse wheel scrolling in Silverlight without extending controls

Introduction

Silverlight currently does not support mouse wheel events. However, you can attach an event to capture the mouse wheel movement through the HtmlPage object, find the control beneath the mouse position with the VisualTreeHelper class and scrolling the region (DataGrid, Combobox, ScrollViewer, TreeView, etc) through the Automation API.

Source Code and Live Demo

Mouse wheel event

There are several examples on the net how to capture the mouse wheel event. The following code snippet shows this very shortly. You can find a full example here (Thanks to Mike Snow): http://silverlight.net/blogs/msnow/archive/2008/07/29/tip-of-the-day-23-how-to-capture-the-mouse-wheel-event.aspx

public TestPage()
{
	InitializeComponent();
	HtmlPage.Window.AttachEvent("DOMMouseScroll", OnMouseWheel);
	HtmlPage.Window.AttachEvent("onmousewheel", OnMouseWheel);
	HtmlPage.Document.AttachEvent("onmousewheel", OnMouseWheel);
}

private void OnMouseWheel(object sender, HtmlEventArgs args)
{
	// code goes here…
}

Scrolling with the UI Automation API

As next step we have to implement programmatically scrolling for different types of controls, such as Combobox, Treeview, DataGrid, ItemsControl, ScrollViewer, etc. But how do we programmatically scroll those controls without implementing special derived classes from it. Furthermore the scrolling support for the DataGrid is unfortunately not implemented by using ScrollViewers to do scrolling. Instead the DataGrid implements a method called ScrollIntoView which is not really helpfully here.

As I played with the Silverlight UI Automation API (UIA), I found a very interesting interface called IScrollProvider. This interface is exposed through the UIA and enables us scrolling out of the box. The UIA Provider interfaces are meant for Screen readers and general automation (testing) but can equally be used at runtime.

// get automation peer
AutomationPeer automationPeer = FrameworkElementAutomationPeer.FromElement(element);
if (automationPeer == null)
{
    // create automation peer for element
    automationPeer = FrameworkElementAutomationPeer.CreatePeerForElement(element);
}
// try to get scroll provider
IScrollProvider scrollProvider = automationPeer.GetPattern(PatternInterface.Scroll) as IScrollProvider;
if (scrollProvider != null)
{
    scrollProvider.Scroll(horizontalScrollAmount, verticalScrollAmount);
}

That’s it!

Connect wheel event to the controls

How do we route the mouse turned event to the right control? You can implement the code above for every control where we need mouse scrolling and enable/disable it with the MouseEnter/MouseLeave event. But this brings us a lot of plumbing code and special controls.

The VisualTreeHelper class provides the method FindElementsInHostCoordinates. This method returns a list of UIElements beneath a specified point (the current mouse position).

Our mouse wheel class (see sample code here) always knows the current mouse position througth the subscribed MouseMove event on the root UIElement.

Here the code (reduced to the important lines):

// go through all element beneath the current mouse position
IEnumerable<UIElement> elements = VisualTreeHelper.FindElementsInHostCoordinates(currentPoint, s_rootElement);
foreach (UIElement element in elements)
{
    // get automation peer (if already created for this control)
    AutomationPeer automationPeer = FrameworkElementAutomationPeer.FromElement(element);
    if (automationPeer == null)
    {
        // create automation peer for element
        automationPeer = FrameworkElementAutomationPeer.CreatePeerForElement(element);
    }

    //expect null: some elements doesn't have an automation peer implemented
    if (automationPeer != null)
    {
        // try to get scroll provider
        IScrollProvider scrollProvider = automationPeer.GetPattern(PatternInterface.Scroll) as IScrollProvider;
        if (scrollProvider != null)
        {
            if (scrollProvider.VerticallyScrollable)
            {
                scrollProvider.Scroll(ScrollAmount.NoAmount, scrollAmount);

                // break the further search in the uielement collection
                break;
            }

            // don't break here, because of encapsulated scroll viewers such as in the treeview from the sl-toolkit
            //break;
        }
    }
}

 

Misc

With pressing the control key, horizontal scrolling is possible also:

// horizontal scrolling?
bool ctrlKey = (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control;

if (scrollProvider.HorizontallyScrollable && ctrlKey)
{
    scrollProvider.Scroll(scrollAmount, ScrollAmount.NoAmount);
}

Conclusion

The UIA (UI Autamation API) provide an eas way to do scrolling without extending the existing controls and the VisualTreeHelper gets the possibility to dispatch the mouse wheel-turned event to the right control.

Most of the controls with scrolling regions implements the IScrollProvider API, unfortunately Textbox not. I’m trying to get another way to enable scrolling for textbox.

Tagged