tags:

views:

691

answers:

2

I've been testing Blu and I noticed I could drag the window. This window is transparent. I tried to do the same with a Thumb, but I don't know how to put it transparent. The rest of the window is transparent, but the thumb is not.

Is there any way to make the thumb transparent, or should I use other technique?

I use this event:

 private void DragThumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
    {
        Canvas.SetLeft(this, Canvas.GetLeft(this) + e.HorizontalChange);
        Canvas.SetTop(this, Canvas.GetTop(this) + e.VerticalChange);
    }

Thank you

+4  A: 

Not sure if I understand your question correctly, but to drag a wpf window, all you need to type in the click event handler of a component on the form (or the form itsself) is:

this.DragMove();

There is no need to implement the dragging functionality yourself.


Update: small example: Create a window, place a button in it. Wire the MouseDown of the window and the Click of the button as:

    private void Window_MouseDown(object sender, MouseButtonEventArgs e)
{
    this.DragMove();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
 MessageBox.Show("hey");
}

Works perfectly, you can drag the window, and the button continues to work...

Tom Deleu
Thanks for the answer Tom. I think that can be the solution. Tried it with a mousemove + leftbutton pressed in a grid and it worked partially. The buttons of the window stopped working. Do you have a working example?
Artur Carvalho
Did a quick test, and everything is working over here... See my original answer for update with small example.
Tom Deleu
A: 

You can turn a thumb control invisible with the Opacity attribute.

Opacity="1" (full visible)

or

Opacity="0" (not visible)

Sample from my application

        <Thumb Name="myThumb" Width="10" Height="10" DragDelta="onDragDelta" DragStarted="onDragStarted" DragCompleted="onDragCompleted" Margin="5" HorizontalAlignment="Right" Opacity="1">

        </Thumb>
Holli