Solved - DragMove

Jul 11, 2010 at 8:23 AM

Hello, first of all, thanks for the great office style implementation,

in order to show how I appreciate the control, here is are my tips:

1.- In the AdvancedColorPickerDialog, I changed the header to this:

<Grid x:Name="titlePanel" MouseLeftButtonDown="titlePanel_MouseLeftButtonDown" Cursor="ScrollAll"  >
          <TextBlock Text="Advanced Color Palette" VerticalAlignment="Center" Margin="5,0,0,0"  />
         <!--<Thumb x:Name="moveThumb" BorderThickness="0" HorizontalAlignment="Stretch" Tag="{Binding Title}"  />-->
        <Button Style="{DynamicResource DialogCloseButtonStyle}" Click="Cancel_Click" HorizontalAlignment="Right" VerticalAlignment="Center" BorderThickness="0" Margin="5,0" Background="Transparent" Cursor="Hand">
        </Button>
</Grid>
As you see, I added a MouseLeftButtonDown in the titlePanel Grid and I removed the ThumbControl, I put the Cursor ScrollAll in the Grid.

2.- In the code behind, at the MouseLeftButtonDown event:

private void titlePanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if ((sender as FrameworkElement).Name == "titlePanel")
                (this.Parent as Window).DragMove();
        }

Why the drag originally doesn't work? I am not sure, but my recommendation is use Grid and Grid.RowDefinitions instead of stacking when it is about container controls.

Now I'm going to try use it in SL4.

Best regards, Juan Pablo