Dev des 4 User Panels Resizables avec un pivot basique.
authorsarias
Fri, 11 Sep 2009 10:58:35 +0200
changeset 45 f003ae353cd7
parent 44 9c6ea1f246da
child 46 f1a26ca4177e
Dev des 4 User Panels Resizables avec un pivot basique. Test direct dans la solution FingersDance
src/FingersDance.Control.Player/UserControlPlayer.xaml
src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml
src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml
src/FingersDance/App.xaml
src/FingersDance/FingersDance.csproj
src/FingersDance/MainSurfaceWindow.xaml
src/FingersDance/MainSurfaceWindow.xaml.cs
src/FingersDance/Resources/Lake.wmv
src/FingersDance/SurfaceWindow1.xaml
src/FingersDance/SurfaceWindow1.xaml.cs
test/Control.UserPanel.Test/Control.UserPanel.Test/SurfaceWindow1.xaml
--- a/src/FingersDance.Control.Player/UserControlPlayer.xaml	Thu Sep 10 16:04:28 2009 +0200
+++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml	Fri Sep 11 10:58:35 2009 +0200
@@ -6,18 +6,20 @@
 	mc:Ignorable="d"
 	x:Class="FingersDance.Control.Player.UserControlPlayer"
 	x:Name="UserControl"
-	Width="450" Height="334" xmlns:Custom="http://schemas.microsoft.com/surface/2008">
+	Width="560" Height="400" xmlns:Custom="http://schemas.microsoft.com/surface/2008">
 	<UserControl.Resources>
 		<Storyboard x:Key="OnClick1"/>
 	</UserControl.Resources>
 	<UserControl.Triggers>
 	</UserControl.Triggers>
-        <Grid x:Name="LayoutRoot" Width="Auto" Height="Auto" Background="{x:Null}">
-		<Grid Width="Auto" MaxWidth="500" Background="#FF000000">
-			<MediaElement x:Name="MediaElementVideo" MediaOpened="MediaElementVideo_MediaOpened" />
-			<Custom:SurfaceButton x:Name="Rewind_area" Content="Play/Pause" ContactDown="ButtonRewind_ContactDown" Click="ButtonRewind_Click" Foreground="{x:Null}" Background="#FFF7F0F0" BorderBrush="{x:Null}" Opacity="0" Width="72" HorizontalAlignment="Left"/>
-			<Custom:SurfaceButton x:Name="Fast_Forward_area" Content="Play/Pause" ContactDown="ButtonFastForward_ContactDown" Click="ButtonFastForward_Click" Foreground="{x:Null}" Background="#FFF7F0F0" BorderBrush="{x:Null}" Opacity="0" Width="72" HorizontalAlignment="Right"/>
-			<Custom:SurfaceButton x:Name="Play_Pause_area" ContactDown="ButtonPlayPause_ContactDown" Click="ButtonPlayPause_Click" Foreground="{x:Null}" Margin="76,0,76,0" Background="#FFF7F0F0" BorderBrush="{x:Null}" Opacity="0"/>
-		</Grid>
-	</Grid>
+        <Grid x:Name="LayoutRoot" Width="{Binding Path=ActualWidth, ElementName=UserControl, Mode=Default}" Height="{Binding Path=ActualHeight, ElementName=UserControl, Mode=Default}" Background="{x:Null}" >
+        	<Viewbox Margin="0,0,0,0" Width="{Binding Path=ActualWidth, ElementName=UserControl, Mode=Default}" Height="{Binding Path=ActualHeight, ElementName=UserControl, Mode=Default}" Stretch="Uniform">
+        		<Grid Width="560" Height="400">
+        			<MediaElement x:Name="MediaElementVideo" MediaOpened="MediaElementVideo_MediaOpened" Stretch="Fill" ScrubbingEnabled="False" StretchDirection="Both" />
+        			<Custom:SurfaceButton x:Name="Rewind_area" Content="Play/Pause" ContactDown="ButtonRewind_ContactDown" Click="ButtonRewind_Click" Foreground="{x:Null}" Background="#FFF7F0F0" BorderBrush="{x:Null}" Opacity="0" Width="72" HorizontalAlignment="Left"/>
+        			<Custom:SurfaceButton x:Name="Fast_Forward_area" Content="Play/Pause" ContactDown="ButtonFastForward_ContactDown" Click="ButtonFastForward_Click" Foreground="{x:Null}" Background="#FFF7F0F0" BorderBrush="{x:Null}" Opacity="0" Width="72" HorizontalAlignment="Right"/>
+        			<Custom:SurfaceButton x:Name="Play_Pause_area" ContactDown="ButtonPlayPause_ContactDown" Click="ButtonPlayPause_Click" Foreground="{x:Null}" Background="#FFF7F0F0" BorderBrush="{x:Null}" Opacity="0" Margin="76,0,76,0"/>
+        		</Grid>
+        	</Viewbox>
+        </Grid>
  </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml	Thu Sep 10 16:04:28 2009 +0200
+++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml	Fri Sep 11 10:58:35 2009 +0200
@@ -9,8 +9,12 @@
 	x:Class="FingersDance.Control.SyncSource.UserControlSyncSource"
 	x:Name="UserControl" Height="384" Width="512">
 
-    <Grid x:Name="LayoutRoot" Height="192" Width="256">
-        <FingersDance_Control_TimeLine:UserControlTimeLine Margin="-127,-91,-131,0" VerticalAlignment="Top" Height="31" x:Name="UserControlTimeLine" DragStarted="UserControlTimeLine_DragStarted" DragCompleted="UserControlTimeLine_DragCompleted" TimerTick="UserControlTimeLine_TimerTick"/>
-        <FingersDance_Control_Player:UserControlPlayer Margin="-92,-56,-102,-86" PlayerOpened="UserControlPlayer_PlayerOpened" x:Name="UserControlPlayer" d:LayoutOverrides="HorizontalAlignment" />
+    <Grid x:Name="LayoutRoot" Height="{Binding Path=ActualHeight, ElementName=UserControl, Mode=Default}" Width="{Binding Path=ActualWidth, ElementName=UserControl, Mode=Default}">
+        <Grid VerticalAlignment="Top" Height="50" x:Name="GridTimeLine">
+        	<FingersDance_Control_TimeLine:UserControlTimeLine Margin="0,0,0,20" Height="Auto" x:Name="UserControlTimeLine" DragStarted="UserControlTimeLine_DragStarted" DragCompleted="UserControlTimeLine_DragCompleted" TimerTick="UserControlTimeLine_TimerTick" Width="{Binding Path=ActualWidth, ElementName=LayoutRoot, Mode=Default}" HorizontalAlignment="Left" d:LayoutOverrides="Height"/>
+        </Grid>
+        <Grid HorizontalAlignment="Stretch" Width="Auto" Height="Auto" VerticalAlignment="Stretch" x:Name="GridPlayer" Margin="0,54,0,0">
+        	<FingersDance_Control_Player:UserControlPlayer PlayerOpened="UserControlPlayer_PlayerOpened" x:Name="UserControlPlayer" VerticalAlignment="Stretch" d:LayoutOverrides="GridBox" Width="{Binding Path=ActualWidth, ElementName=GridPlayer, Mode=Default}" Margin="0,0,0,0" Height="{Binding Path=ActualHeight, ElementName=GridPlayer, Mode=Default}" />
+        </Grid>
     </Grid>
 </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml	Thu Sep 10 16:04:28 2009 +0200
+++ b/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml	Fri Sep 11 10:58:35 2009 +0200
@@ -9,8 +9,8 @@
 	d:DesignWidth="640" d:DesignHeight="480" 
     xmlns:FingersDance_Control_SyncSource="clr-namespace:FingersDance.Control.SyncSource;assembly=FingersDance.Control.SyncSource">
 
-	<Grid x:Name="LayoutRoot">
-        <FingersDance_Control_SyncSource:UserControlSyncSource x:Name="UserControlSyncSource"/>
+	<Grid x:Name="LayoutRoot" Background="#1800FF8F">
+        <FingersDance_Control_SyncSource:UserControlSyncSource x:Name="UserControlSyncSource" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="{Binding Path=ActualWidth, ElementName=LayoutRoot, Mode=Default}" Margin="0,0,0,0" Height="{Binding Path=ActualHeight, ElementName=LayoutRoot, Mode=Default}"/>
 
     </Grid>
 </UserControl>
\ No newline at end of file
--- a/src/FingersDance/App.xaml	Thu Sep 10 16:04:28 2009 +0200
+++ b/src/FingersDance/App.xaml	Fri Sep 11 10:58:35 2009 +0200
@@ -1,7 +1,7 @@
 <Application x:Class="FingersDance.App"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    StartupUri="SurfaceWindow1.xaml"
+    StartupUri="MainSurfaceWindow.xaml"
     >
     <Application.Resources>
       <ResourceDictionary>
--- a/src/FingersDance/FingersDance.csproj	Thu Sep 10 16:04:28 2009 +0200
+++ b/src/FingersDance/FingersDance.csproj	Fri Sep 11 10:58:35 2009 +0200
@@ -105,8 +105,8 @@
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
       <DependentUpon>Settings.settings</DependentUpon>
     </Compile>
-    <Compile Include="SurfaceWindow1.xaml.cs">
-      <DependentUpon>SurfaceWindow1.xaml</DependentUpon>
+    <Compile Include="MainSurfaceWindow.xaml.cs">
+      <DependentUpon>MainSurfaceWindow.xaml</DependentUpon>
     </Compile>
     <AppDesigner Include="Properties\" />
   </ItemGroup>
@@ -117,16 +117,23 @@
     <Content Include="Resources\iconPreview.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
+    <Content Include="Resources\Lake.wmv" />
     <Resource Include="FingersDance.xml" />
   </ItemGroup>
   <ItemGroup>
     <Resource Include="Resources\WindowBackground.jpg" />
   </ItemGroup>
   <ItemGroup>
-    <Page Include="SurfaceWindow1.xaml">
+    <Page Include="MainSurfaceWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\FingersDance.Control.UserPanel\FingersDance.Control.UserPanel.csproj">
+      <Project>{E6A3A067-1CB4-43D2-BB9C-DC72361F7E22}</Project>
+      <Name>FingersDance.Control.UserPanel</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance/MainSurfaceWindow.xaml	Fri Sep 11 10:58:35 2009 +0200
@@ -0,0 +1,57 @@
+<s:SurfaceWindow
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:s="http://schemas.microsoft.com/surface/2008"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
+    x:Class="FingersDance.SurfaceWindow1"
+    Title="FingersDance"
+    Width="1024" Height="768" x:Name="mainSurfaceWindow"
+    xmlns:FingersDance_Control_UserPanel="clr-namespace:FingersDance.Control.UserPanel;assembly=FingersDance.Control.UserPanel"
+    >
+  <s:SurfaceWindow.Resources>
+    <ImageBrush x:Key="WindowBackground" Stretch="None" Opacity="0.6" ImageSource="pack://application:,,,/Resources/WindowBackground.jpg"/>
+  </s:SurfaceWindow.Resources>
+
+  <Grid Background="{StaticResource WindowBackground}" x:Name="MainGrid" Width="1024" Height="768" >
+
+  	<Grid HorizontalAlignment="Left" x:Name="Grid1" VerticalAlignment="Top" Width="100" Height="100" Background="#7EFAFAFA">
+  		<FingersDance_Control_UserPanel:UserControlUserPanel/>
+  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF"/>
+  	</Grid>
+  	<Grid HorizontalAlignment="Right" Margin="0,0,0,0" x:Name="Grid4" VerticalAlignment="Top" Width="100" Height="100" Background="#7FFFFFFF">
+  		<FingersDance_Control_UserPanel:UserControlUserPanel/>
+  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF"/>
+  	</Grid>
+  	<Grid HorizontalAlignment="Right" Margin="0,0,0,0" x:Name="Grid3" VerticalAlignment="Bottom" Width="100" Height="100" Background="#7FFFFFFF">
+  		<FingersDance_Control_UserPanel:UserControlUserPanel/>
+  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF"/>
+  	</Grid>
+  	<Grid RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="0,0,0,0" x:Name="Grid2" VerticalAlignment="Bottom" Width="100" Height="100" Background="#7EFFFFFF">
+  		<Grid.RenderTransform>
+  			<TransformGroup>
+  				<ScaleTransform ScaleX="1" ScaleY="1"/>
+  				<SkewTransform AngleX="0" AngleY="0"/>
+  				<RotateTransform Angle="0"/>
+  				<TranslateTransform X="0" Y="0"/>
+  			</TransformGroup>
+  		</Grid.RenderTransform>
+  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF"/>
+  		<FingersDance_Control_UserPanel:UserControlUserPanel/>
+  	</Grid>
+  	<s:ScatterView x:Name="ScaterView"  ContactChanged="ScaterView_ContactChanged">
+            <s:ScatterViewItem CanMove="True" CanRotate="False" CanScale="False" >
+                <Ellipse Width="55" Height="55" Fill="#FF101010" Stroke="#FF000000" x:Name="pivot" RenderTransformOrigin="0.5,0.5">
+  			        <Ellipse.RenderTransform>
+  				        <TransformGroup>
+  					        <ScaleTransform ScaleX="1" ScaleY="1"/>
+  					        <SkewTransform AngleX="0" AngleY="0"/>
+  					        <RotateTransform Angle="0"/>
+  					        <TranslateTransform X="0" Y="0"/>
+  				        </TransformGroup>
+  			        </Ellipse.RenderTransform>
+  		        </Ellipse>
+                </s:ScatterViewItem>
+  	</s:ScatterView>
+
+  </Grid>
+</s:SurfaceWindow>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs	Fri Sep 11 10:58:35 2009 +0200
@@ -0,0 +1,122 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using System.Windows.Threading;
+using Microsoft.Surface;
+using Microsoft.Surface.Presentation;
+using Microsoft.Surface.Presentation.Controls;
+
+namespace FingersDance
+{
+    /// <summary>
+    /// Interaction logic for SurfaceWindow1.xaml
+    /// </summary>
+    public partial class SurfaceWindow1 : SurfaceWindow
+    {
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        public SurfaceWindow1()
+        {
+            InitializeComponent();
+
+            // Add handlers for Application activation events
+            AddActivationHandlers();
+        }
+
+
+        /// <summary>
+        /// Occurs when the window is about to close. 
+        /// </summary>
+        /// <param name="e"></param>
+        protected override void OnClosed(EventArgs e)
+        {
+            base.OnClosed(e);
+
+            // Remove handlers for Application activation events
+            RemoveActivationHandlers();
+        }
+
+        /// <summary>
+        /// Adds handlers for Application activation events.
+        /// </summary>
+        private void AddActivationHandlers()
+        {
+            // Subscribe to surface application activation events
+            ApplicationLauncher.ApplicationActivated += OnApplicationActivated;
+            ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed;
+            ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated;
+        }
+
+        /// <summary>
+        /// Removes handlers for Application activation events.
+        /// </summary>
+        private void RemoveActivationHandlers()
+        {
+            // Unsubscribe from surface application activation events
+            ApplicationLauncher.ApplicationActivated -= OnApplicationActivated;
+            ApplicationLauncher.ApplicationPreviewed -= OnApplicationPreviewed;
+            ApplicationLauncher.ApplicationDeactivated -= OnApplicationDeactivated;
+        }
+
+        /// <summary>
+        /// This is called when application has been activated.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void OnApplicationActivated(object sender, EventArgs e)
+        {
+            //TODO: enable audio, animations here
+        }
+
+        /// <summary>
+        /// This is called when application is in preview mode.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void OnApplicationPreviewed(object sender, EventArgs e)
+        {
+            //TODO: Disable audio here if it is enabled
+
+            //TODO: optionally enable animations here
+        }
+
+        /// <summary>
+        ///  This is called when application has been deactivated.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void OnApplicationDeactivated(object sender, EventArgs e)
+        {
+            //TODO: disable audio, animations here
+        }
+
+        private void ScaterView_ContactChanged(object sender, ContactEventArgs e)
+        {
+            try
+            {
+                Grid1.Width = e.GetPosition(mainSurfaceWindow).X;
+                Grid1.Height = e.GetPosition(mainSurfaceWindow).Y;
+
+                Grid2.Width = e.GetPosition(mainSurfaceWindow).X;
+                Grid2.Height = 768 - e.GetPosition(mainSurfaceWindow).Y;
+
+                Grid3.Width = 1024 - e.GetPosition(mainSurfaceWindow).X;
+                Grid3.Height = 768 - e.GetPosition(mainSurfaceWindow).Y;
+
+                Grid4.Width = 1024 - e.GetPosition(mainSurfaceWindow).X;
+                Grid4.Height = e.GetPosition(mainSurfaceWindow).Y;
+            }
+            catch (Exception ex) { }
+        }
+    }
+}
\ No newline at end of file
Binary file src/FingersDance/Resources/Lake.wmv has changed
--- a/src/FingersDance/SurfaceWindow1.xaml	Thu Sep 10 16:04:28 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-<s:SurfaceWindow
-    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    xmlns:s="http://schemas.microsoft.com/surface/2008"
-    x:Class="FingersDance.SurfaceWindow1"
-    Title="FingersDance"
-    Width="1024" Height="768" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Name="mainSurfaceWindow"
-    >
-  <s:SurfaceWindow.Resources>
-    <ImageBrush x:Key="WindowBackground" Stretch="None" Opacity="0.6" ImageSource="pack://application:,,,/Resources/WindowBackground.jpg"/>
-  </s:SurfaceWindow.Resources>
-
-  <Grid Background="{StaticResource WindowBackground}" x:Name="MainGrid" Width="1024" Height="768" >
-
-  	<Grid HorizontalAlignment="Left" x:Name="Grid1" VerticalAlignment="Top" Width="100" Height="100" Background="#7EFAFAFA">
-  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF"/>
-  	</Grid>
-  	<Grid HorizontalAlignment="Right" Margin="0,0,0,0" x:Name="Grid4" VerticalAlignment="Top" Width="100" Height="100" Background="#7FFFFFFF">
-  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF"/>
-  	</Grid>
-  	<Grid HorizontalAlignment="Right" Margin="0,0,0,0" x:Name="Grid3" VerticalAlignment="Bottom" Width="100" Height="100" Background="#7FFFFFFF">
-  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF"/>
-  	</Grid>
-  	<Grid RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="0,0,0,0" x:Name="Grid2" VerticalAlignment="Bottom" Width="100" Height="100" Background="#7EFFFFFF">
-  		<Grid.RenderTransform>
-  			<TransformGroup>
-  				<ScaleTransform ScaleX="-1" ScaleY="1"/>
-  				<SkewTransform AngleX="0" AngleY="0"/>
-  				<RotateTransform Angle="0"/>
-  				<TranslateTransform X="0" Y="0"/>
-  			</TransformGroup>
-  		</Grid.RenderTransform>
-  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF"/>
-  	</Grid>
-  	<s:ScatterView x:Name="ScaterView"  ContactChanged="ScaterView_ContactChanged">
-            <s:ScatterViewItem CanMove="True" CanRotate="False" CanScale="False" >
-                <Ellipse Width="55" Height="55" Fill="#FF101010" Stroke="#FF000000" x:Name="pivot" RenderTransformOrigin="0.5,0.5">
-  			        <Ellipse.RenderTransform>
-  				        <TransformGroup>
-  					        <ScaleTransform ScaleX="1" ScaleY="1"/>
-  					        <SkewTransform AngleX="0" AngleY="0"/>
-  					        <RotateTransform Angle="0"/>
-  					        <TranslateTransform X="0" Y="0"/>
-  				        </TransformGroup>
-  			        </Ellipse.RenderTransform>
-  		        </Ellipse>
-                </s:ScatterViewItem>
-  	</s:ScatterView>
-
-  </Grid>
-</s:SurfaceWindow>
--- a/src/FingersDance/SurfaceWindow1.xaml.cs	Thu Sep 10 16:04:28 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-using System.Windows.Threading;
-using Microsoft.Surface;
-using Microsoft.Surface.Presentation;
-using Microsoft.Surface.Presentation.Controls;
-
-namespace FingersDance
-{
-    /// <summary>
-    /// Interaction logic for SurfaceWindow1.xaml
-    /// </summary>
-    public partial class SurfaceWindow1 : SurfaceWindow
-    {
-        /// <summary>
-        /// Default constructor.
-        /// </summary>
-        public SurfaceWindow1()
-        {
-            InitializeComponent();
-
-            // Add handlers for Application activation events
-            AddActivationHandlers();
-        }
-
-
-        /// <summary>
-        /// Occurs when the window is about to close. 
-        /// </summary>
-        /// <param name="e"></param>
-        protected override void OnClosed(EventArgs e)
-        {
-            base.OnClosed(e);
-
-            // Remove handlers for Application activation events
-            RemoveActivationHandlers();
-        }
-
-        /// <summary>
-        /// Adds handlers for Application activation events.
-        /// </summary>
-        private void AddActivationHandlers()
-        {
-            // Subscribe to surface application activation events
-            ApplicationLauncher.ApplicationActivated += OnApplicationActivated;
-            ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed;
-            ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated;
-        }
-
-        /// <summary>
-        /// Removes handlers for Application activation events.
-        /// </summary>
-        private void RemoveActivationHandlers()
-        {
-            // Unsubscribe from surface application activation events
-            ApplicationLauncher.ApplicationActivated -= OnApplicationActivated;
-            ApplicationLauncher.ApplicationPreviewed -= OnApplicationPreviewed;
-            ApplicationLauncher.ApplicationDeactivated -= OnApplicationDeactivated;
-        }
-
-        /// <summary>
-        /// This is called when application has been activated.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void OnApplicationActivated(object sender, EventArgs e)
-        {
-            //TODO: enable audio, animations here
-        }
-
-        /// <summary>
-        /// This is called when application is in preview mode.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void OnApplicationPreviewed(object sender, EventArgs e)
-        {
-            //TODO: Disable audio here if it is enabled
-
-            //TODO: optionally enable animations here
-        }
-
-        /// <summary>
-        ///  This is called when application has been deactivated.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void OnApplicationDeactivated(object sender, EventArgs e)
-        {
-            //TODO: disable audio, animations here
-        }
-
-        private void ScaterView_ContactChanged(object sender, ContactEventArgs e)
-        {
-            try
-            {
-                Grid1.Width = e.GetPosition(mainSurfaceWindow).X;
-                Grid1.Height = e.GetPosition(mainSurfaceWindow).Y;
-
-                Grid2.Width = e.GetPosition(mainSurfaceWindow).X;
-                Grid2.Height = 768 - e.GetPosition(mainSurfaceWindow).Y;
-
-                Grid3.Width = 1024 - e.GetPosition(mainSurfaceWindow).X;
-                Grid3.Height = 768 - e.GetPosition(mainSurfaceWindow).Y;
-
-                Grid4.Width = 1024 - e.GetPosition(mainSurfaceWindow).X;
-                Grid4.Height = e.GetPosition(mainSurfaceWindow).Y;
-            }
-            catch (Exception ex) { }
-        }
-    }
-}
\ No newline at end of file
--- a/test/Control.UserPanel.Test/Control.UserPanel.Test/SurfaceWindow1.xaml	Thu Sep 10 16:04:28 2009 +0200
+++ b/test/Control.UserPanel.Test/Control.UserPanel.Test/SurfaceWindow1.xaml	Fri Sep 11 10:58:35 2009 +0200
@@ -5,15 +5,18 @@
     xmlns:FingersDance_Control_UserPanel="clr-namespace:FingersDance.Control.UserPanel;assembly=FingersDance.Control.UserPanel"
     x:Class="Control.UserPanel.Test.SurfaceWindow1"
     Title="Control.UserPanel.Test"
-    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+    mc:Ignorable="d"
+    Height="768" Width="1024"
     >
   <s:SurfaceWindow.Resources>
     <ImageBrush x:Key="WindowBackground" Stretch="None" Opacity="0.6" ImageSource="pack://application:,,,/Resources/WindowBackground.jpg"/>
   </s:SurfaceWindow.Resources>
 
   <Grid Background="{StaticResource WindowBackground}" Height="768" Width="1024">
-  	<FingersDance_Control_UserPanel:UserControlUserPanel x:Name="UserControlUserPanel1" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment" Margin="0,0,468.427,371.741" />
-<FingersDance_Control_UserPanel:UserControlUserPanel x:Name="UserControlUserPanel2" Margin="512,0,0,0" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment" Height="383.41" VerticalAlignment="Bottom" />
+  	<FingersDance_Control_UserPanel:UserControlUserPanel x:Name="UserControlUserPanel1" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment" Height="286.724" HorizontalAlignment="Left" VerticalAlignment="Top" Width="331.733" />
+<FingersDance_Control_UserPanel:UserControlUserPanel x:Name="UserControlUserPanel2" Margin="15.003,288.391,325.065,56.678" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment" />
 
   </Grid>
 </s:SurfaceWindow>