Posts Tagged ‘Mouse’
05
Oct

Open ComboBox by Mouse Over

Post a comment » Popularity: 31%

Jacek Ciereszko created an behavior class which allow users to open the combobox menu without mouse click. Simply move over the control and it will open automatically.

Open ComboBox by Mouse Over

View Demo: New Window
26
Sep

Color Fill Toy

Post a comment » Popularity: 1%

When you click on the grid, it will be filled up with a random color.

Color Fill Toy

View Demo: New Window
26
Sep

Double Click

Post a comment » Popularity: 1%

The is no native support for double click in Silverlight 3. However, Terence Tsang created a sample to tackle this problem. When you double click on the application, a random geometry object will pop up.

Double Click

View Demo: New Window
15
Sep

Simulate Double Click

Post a comment » Popularity: 1%

There is no native support for double click in Silverlight. Mike has a workaround to solve this problem. This is achieved by using a combination of DispatcherTimer and MouseDown Event.

 double-click

View Demo: New Window
How to simulate double click in C#:
DispatcherTimer _doubleClickTimer;

public Page()
{
    InitializeComponent();
    _doubleClickTimer = new DispatcherTimer();
    _doubleClickTimer.Interval = new TimeSpan(0, 0, 0, 0, 200);
    _doubleClickTimer.Tick += new EventHandler(DoubleClick_Timer);
    this.MouseLeftButtonDown += new MouseButtonEventHandler(Page_MouseLeftButtonDown);
}

// too much time has passed for it to be a double click.
void DoubleClick_Timer(object sender, EventArgs e)
{
    _doubleClickTimer.Stop();
}

void Page_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
    if (_doubleClickTimer.IsEnabled)
    {
        // a double click has occured
        _doubleClickTimer.Stop();
    }
    else
    {
        _doubleClickTimer.Start();
    }
}