Share via


Implementing Aero Shake in a WindoStyle None WPF Window

I just tried to implement Aero Shake in a WindowStyle=None WPF window.

I had no clue what I would need to do; I figured I had to start by dragging the Window..   tried that, ran it just to see what would happen and voila! Windows 7 did the rest… 

I am going to the movies (since I had budgeted 3 hours for this)..   Thanks Windows 7 Shell team!

 <Window x:Class="WpfApplication40.Window1"
    xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300" MouseLeftButtonDown="Window_MouseLeftButtonDown" 
        Opacity="0.5" WindowStyle="None" AllowsTransparency="True"  >
    
    <Grid>
        <TextBlock Text="Shake me.. please" VerticalAlignment="Center" 
                   HorizontalAlignment="Center" FontSize="60"/> 
     </Grid>
</Window>

 

 private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
       {
           this.DragMove();            
       }