ClickMenuItem modification : path rotation & image display
authorMatthieu Totet
Mon, 23 Nov 2009 14:46:38 +0100
changeset 8 2482ddb44cb6
parent 7 de7ba61f66c7
child 9 185e3ab53a56
ClickMenuItem modification : path rotation & image display
client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenu.xaml
client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenuItem.xaml
client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenuItem.xaml.cs
client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenuPanelAnnoter.xaml
client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenuPanelContextualiser.xaml
client/src/Iri.Modernisation.Styles/Iri.Modernisation.Styles.csproj
--- a/client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenu.xaml	Mon Nov 23 10:17:33 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenu.xaml	Mon Nov 23 14:46:38 2009 +0100
@@ -16,10 +16,10 @@
 	<Grid  x:Name="LayoutRoot" Margin="0,0,0,-8" MouseLeftButtonUp="LayoutRoot_MouseLeftButtonUp" Background="Transparent">
 		
 		<local:ClickMenuPanelAnnoter x:Name="_annoterPanel" Margin="47,5,0,0" VerticalAlignment="Top" d:LayoutOverrides="Width, Height" HorizontalAlignment="Left"/>
-		<local:ClickMenuPanelContextualiser x:Name="_contextualiserPanel" VerticalAlignment="Top" d:LayoutOverrides="Width, Height" Margin="37,49,0,0" HorizontalAlignment="Left"/>
-		<local:ClickMenuItem  Title="Localiser" x:Name="_localiserItem" HorizontalAlignment="Left" VerticalAlignment="Top" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment, Height" Margin="26,4,0,0"/>
-		<local:ClickMenuItem Title="Chutier" x:Name="_chutierItem" HorizontalAlignment="Left" Margin="3,21,0,0" VerticalAlignment="Top" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment, Height"/>
-		<local:ClickMenuItem Title="Copier"  x:Name="_copierItem" HorizontalAlignment="Left" Margin="11,48,0,0" VerticalAlignment="Top" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment, Height"/>
+		<local:ClickMenuPanelContextualiser  x:Name="_contextualiserPanel" VerticalAlignment="Top" d:LayoutOverrides="Width, Height" Margin="37,49,0,0" HorizontalAlignment="Left"/>
+		<local:ClickMenuItem Orientation="Up" Title="Localiser" x:Name="_localiserItem" HorizontalAlignment="Left" VerticalAlignment="Top" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment, Height" Margin="26,4,0,0"/>
+		<local:ClickMenuItem Orientation="Up" Title="Chutier" x:Name="_chutierItem" HorizontalAlignment="Left" Margin="3,21,0,0" VerticalAlignment="Top" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment, Height"/>
+		<local:ClickMenuItem Orientation="Up" ImageSource="icons/home.png"  Title="Copier"  x:Name="_copierItem" HorizontalAlignment="Left" Margin="11,48,0,0" VerticalAlignment="Top" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment, Height"/>
 		<TextBlock x:Name="textBlock" Height="16" Margin="3,0,0,0" VerticalAlignment="Bottom" TextWrapping="Wrap"/>
 	</Grid>
 </UserControl>
\ No newline at end of file
--- a/client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenuItem.xaml	Mon Nov 23 10:17:33 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenuItem.xaml	Mon Nov 23 14:46:38 2009 +0100
@@ -1,48 +1,25 @@
-<ContentControl
+<UserControl
 	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 	mc:Ignorable="d"
-	x:Class="Iri.Modernisation.Controls.View.ClickMenuItem" MouseEnter="MouseEnter" MouseLeftButtonUp="UserControl_MouseLeftButtonUp">
-	 <ContentControl.Template>
-
-	 <ControlTemplate>
 	
-      <Grid x:Name="RootElement">
-	    <ContentPresenter Canvas.ZIndex="10" 
-              HorizontalAlignment="Center" VerticalAlignment="Center"
-             />
-
-       <Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="path78339" Fill="#FFA1A1A1" Stroke="#FF000000" StrokeThickness="1.20303285" StrokeMiterLimit="4" StrokeDashOffset="0" StrokeLineJoin="Round" StrokeEndLineCap="Flat" Data="M 1131.5 228 L 1100.6059 237.52202 L 1082.0032 211.0825 L 1101.4001 185.21994 L 1131.9908 195.67554 L 1131.5 228 z" Stretch="Fill" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" Height="27.969" VerticalAlignment="Top" HorizontalAlignment="Left" Width="27.053" Margin="1.3,0.882,0,0">
-		<Path.RenderTransform>
-			<TransformGroup>
-				<ScaleTransform/>
-				<SkewTransform/>
-				<RotateTransform Angle="89.162"/>
-				<TranslateTransform/>
-			</TransformGroup>
-		</Path.RenderTransform>
+	x:Class="Iri.Modernisation.Controls.View.ClickMenuItem" MouseEnter="MouseEnter" MouseLeftButtonUp="UserControl_MouseLeftButtonUp" Background="Transparent" RenderTransformOrigin="0.5,0.5">
 	
-	</Path>
-      </Grid>
-	  
-    </ControlTemplate>
-	</ContentControl.Template>
-
-
-	 <!--  <Grid>
-	<Image></Image>
-	<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="path78339" Fill="#FFA1A1A1" Stroke="#FF000000" StrokeThickness="1.20303285" StrokeMiterLimit="4" StrokeDashOffset="0" StrokeLineJoin="Round" StrokeEndLineCap="Flat" Data="M 1131.5 228 L 1100.6059 237.52202 L 1082.0032 211.0825 L 1101.4001 185.21994 L 1131.9908 195.67554 L 1131.5 228 z" Stretch="Fill" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" Height="27.969" VerticalAlignment="Top" HorizontalAlignment="Left" Width="27.053" Margin="1.3,0.882,0,0">
-		<Path.RenderTransform>
-			<TransformGroup>
-				<ScaleTransform/>
-				<SkewTransform/>
-				<RotateTransform Angle="89.162"/>
-				<TranslateTransform/>
-			</TransformGroup>
-		</Path.RenderTransform>
-	
-	</Path>
-</Grid> -->
-</ContentControl>
\ No newline at end of file
+	<Grid>  
+						
+						<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="path78339" Fill="#FFA1A1A1" Stroke="#FF000000" StrokeThickness="1.20303285" StrokeMiterLimit="4" StrokeDashOffset="0" StrokeLineJoin="Round" StrokeEndLineCap="Flat" Data="M 1131.5 228 L 1100.6059 237.52202 L 1082.0032 211.0825 L 1101.4001 185.21994 L 1131.9908 195.67554 L 1131.5 228 z" Stretch="Fill" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" Height="27.969" VerticalAlignment="Top" HorizontalAlignment="Left" Width="27.053" Margin="-0.053,0,0,0">
+							<Path.RenderTransform>
+								<TransformGroup>
+									<ScaleTransform/>
+									<SkewTransform />
+									<RotateTransform Angle="89.433" />
+									<TranslateTransform/>
+								</TransformGroup>
+							</Path.RenderTransform>
+						
+						</Path>
+						<Image x:Name="imgItem" HorizontalAlignment="Left" Width="27" Height="28" VerticalAlignment="Top" Margin="0,2,0,0"/>
+					</Grid>
+					</UserControl>
\ No newline at end of file
--- a/client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenuItem.xaml.cs	Mon Nov 23 10:17:33 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenuItem.xaml.cs	Mon Nov 23 14:46:38 2009 +0100
@@ -10,15 +10,30 @@
 
 namespace Iri.Modernisation.Controls.View
 {
-	public partial class ClickMenuItem : ContentControl
-
+    public enum ClickMenuItemOrientation { Up = 90, Down = 126 }
+	public partial class ClickMenuItem : UserControl
 	{
-        /*
+        
          public ImageSource ImageSource {
             get { return imgItem.Source; }
             set { imgItem.Source = value; }
         }
-         */
+
+        public ClickMenuItemOrientation Orientation
+        {
+            get { return (ClickMenuItemOrientation)GetValue(OrientationProperty); }
+            set { 
+                SetValue(OrientationProperty, value);
+                path78339.RenderTransform = new RotateTransform() {Angle=(double)value };
+            }
+        }
+
+        // Using a DependencyProperty as the backing store for Orientation.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty OrientationProperty =
+            DependencyProperty.Register("Orientation", typeof(ClickMenuItemOrientation), typeof(ClickMenuItem), new PropertyMetadata(ClickMenuItemOrientation.Up));
+
+
+
 
 
         public String Title { get; set; }
--- a/client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenuPanelAnnoter.xaml	Mon Nov 23 10:17:33 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenuPanelAnnoter.xaml	Mon Nov 23 14:46:38 2009 +0100
@@ -12,33 +12,12 @@
 	
 	
 	<Grid x:Name="Panel" Background="#00842B2B" Canvas.ZIndex="4" MouseLeave="Grid_MouseLeave">
-		<local:ClickMenuItem Title="Annoter"  x:Name="_annoterItem" HorizontalAlignment="Left" Margin="1,17,0,0" Width="32" Canvas.ZIndex="10" VerticalAlignment="Top" d:LayoutOverrides="Height" MouseEnter="Grid_MouseEnter"/>
+		<local:ClickMenuItem   Orientation="Up" Title="Annoter"  x:Name="_annoterItem" HorizontalAlignment="Left" Margin="1,17,0,0" Width="32" Canvas.ZIndex="10" VerticalAlignment="Top" d:LayoutOverrides="Height" MouseEnter="Grid_MouseEnter">
+			
+		</local:ClickMenuItem>
 		<Grid x:Name="Hidden" HorizontalAlignment="Left" Width="80" Background="#0041024D" Height="56" VerticalAlignment="Top" Visibility="Collapsed">
-			<local:ClickMenuItem Title="Vidéo" x:Name="_videoItem" HorizontalAlignment="Left" Margin="25.262,25.875,0,0" Width="32" Canvas.ZIndex="5" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" VerticalAlignment="Top">
-				<local:ClickMenuItem.RenderTransform>
-					<TransformGroup>
-						<ScaleTransform/>
-						<SkewTransform/>
-						<RotateTransform Angle="35.759"/>
-						<TranslateTransform/>
-					</TransformGroup>
-				</local:ClickMenuItem.RenderTransform>
-			</local:ClickMenuItem>
-			<local:ClickMenuItem Title="Textuelle" x:Name="_textItem" Margin="15.623,-3.041,34.876,0" VerticalAlignment="Top" RenderTransformOrigin="0.209,0.93" UseLayoutRounding="False" Canvas.ZIndex="5" d:LayoutRounding="Auto" d:LayoutOverrides="VerticalAlignment">
-				<local:ClickMenuItem.RenderTransform>
-					<TransformGroup>
-						<ScaleTransform/>
-						<SkewTransform/>
-						<RotateTransform Angle="-35.478"/>
-						<TranslateTransform X="8.84" Y="2.596"/>
-					</TransformGroup>
-				</local:ClickMenuItem.RenderTransform>
-				<local:ClickMenuItem.Content>
-				
-					<Image x:Name="imgItem" Source="icons/home.png" Stretch="Uniform" IsHitTestVisible="False"  />
-			
-				</local:ClickMenuItem.Content>
-			</local:ClickMenuItem>
+			<local:ClickMenuItem ImageSource="icons/home.png" Orientation="Down" Title="Vidéo" x:Name="_videoItem" HorizontalAlignment="Left" Margin="24,25,0,0" Width="32" Canvas.ZIndex="5" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Top"/>
+			<local:ClickMenuItem Orientation="Down" Title="Textuelle" x:Name="_textItem" Margin="16,-2,34,0" VerticalAlignment="Top" RenderTransformOrigin="0.209,0.93" Canvas.ZIndex="5" d:LayoutOverrides="VerticalAlignment"/>
 		</Grid>
 	</Grid>
 </UserControl>
\ No newline at end of file
--- a/client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenuPanelContextualiser.xaml	Mon Nov 23 10:17:33 2009 +0100
+++ b/client/src/Iri.Modernisation.Controls/View/ClickMenu/ClickMenuPanelContextualiser.xaml	Mon Nov 23 14:46:38 2009 +0100
@@ -8,48 +8,15 @@
 	x:Class="Iri.Modernisation.Controls.View.ClickMenuPanelContextualiser" Height="56" Width="80">
 
 	<Grid x:Name="Panel" Background="#00842B2B" Canvas.ZIndex="4" MouseLeave="Grid_MouseLeave">
-		<local:ClickMenuItem Title="Contextualiser" x:Name="_contextualiserItem" HorizontalAlignment="Left" Margin="1,0,0,0" Width="32" Canvas.ZIndex="10" VerticalAlignment="Top" d:LayoutOverrides="Height" MouseEnter="Grid_MouseEnter"/>
+		<local:ClickMenuItem Orientation="Up" Title="Contextualiser" x:Name="_contextualiserItem" HorizontalAlignment="Left" Margin="1,0,0,0" Width="32" Canvas.ZIndex="10" VerticalAlignment="Top" d:LayoutOverrides="Height" MouseEnter="Grid_MouseEnter"/>
 		<Grid x:Name="Hidden" HorizontalAlignment="Left" Width="80" Background="#0041024D" Height="56" VerticalAlignment="Top" Visibility="Collapsed">
-			<local:ClickMenuItem Title="Polemic" x:Name="_polemicItem" HorizontalAlignment="Left" Margin="1.345,25.837,0,0" Width="32" Canvas.ZIndex="5" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" VerticalAlignment="Top" d:LayoutOverrides="HorizontalAlignment">
-				<local:ClickMenuItem.RenderTransform>
-					<TransformGroup>
-						<ScaleTransform/>
-						<SkewTransform/>
-						<RotateTransform Angle="35.759"/>
-						<TranslateTransform/>
-					</TransformGroup>
-				</local:ClickMenuItem.RenderTransform>
-			</local:ClickMenuItem>
-			<local:ClickMenuItem Title="Adhesion" x:Name="_adhesionItem" Margin="24.5,17.25,26,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" Canvas.ZIndex="5" d:LayoutRounding="Auto">
-				<local:ClickMenuItem.RenderTransform>
-					<TransformGroup>
-						<ScaleTransform/>
-						<SkewTransform/>
-						<RotateTransform Angle="-0.849"/>
-						<TranslateTransform/>
-					</TransformGroup>
-				</local:ClickMenuItem.RenderTransform>
-			</local:ClickMenuItem>
-			<local:ClickMenuItem Title="Reference" x:Name="_referenceItem" HorizontalAlignment="Left" Margin="48.845,25.837,0,0" VerticalAlignment="Top" Width="32" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" Canvas.ZIndex="5" d:LayoutRounding="Auto">
-				<local:ClickMenuItem.RenderTransform>
-					<TransformGroup>
-						<ScaleTransform/>
-						<SkewTransform/>
-						<RotateTransform Angle="35.759"/>
-						<TranslateTransform/>
-					</TransformGroup>
-				</local:ClickMenuItem.RenderTransform>
-			</local:ClickMenuItem>
-			<local:ClickMenuItem Title="Question" x:Name="_questionItem" Margin="0,17.25,-21.5,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" Canvas.ZIndex="5" d:LayoutRounding="Auto" HorizontalAlignment="Right" d:LayoutOverrides="Width">
-				<local:ClickMenuItem.RenderTransform>
-					<TransformGroup>
-						<ScaleTransform/>
-						<SkewTransform/>
-						<RotateTransform Angle="-0.849"/>
-						<TranslateTransform/>
-					</TransformGroup>
-				</local:ClickMenuItem.RenderTransform>
-			</local:ClickMenuItem>
+			<local:ClickMenuItem Orientation="Down" Title="Polemic" x:Name="_polemicItem" HorizontalAlignment="Left" Margin="1,24,0,0" Width="32" Canvas.ZIndex="5" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Top" d:LayoutOverrides="HorizontalAlignment"/>
+			
+			<local:ClickMenuItem Title="Adhesion" Orientation="Up" x:Name="_adhesionItem" Margin="23,17,28,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Canvas.ZIndex="5"/>
+			
+			<local:ClickMenuItem Title="Reference" Orientation="Down" x:Name="_referenceItem" HorizontalAlignment="Left" Margin="46,25,0,0" VerticalAlignment="Top" Width="32" RenderTransformOrigin="0.5,0.5" Canvas.ZIndex="5"/>
+			
+			<local:ClickMenuItem Title="Question" Orientation="Up" x:Name="_questionItem" Margin="0,18,-14,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Canvas.ZIndex="5" HorizontalAlignment="Right"/>
 		</Grid>
 	</Grid>
 </UserControl>
\ No newline at end of file
--- a/client/src/Iri.Modernisation.Styles/Iri.Modernisation.Styles.csproj	Mon Nov 23 10:17:33 2009 +0100
+++ b/client/src/Iri.Modernisation.Styles/Iri.Modernisation.Styles.csproj	Mon Nov 23 14:46:38 2009 +0100
@@ -14,6 +14,7 @@
     <SilverlightApplication>false</SilverlightApplication>
     <ValidateXaml>true</ValidateXaml>
     <ThrowErrorsInValidation>true</ThrowErrorsInValidation>
+    <ExpressionBlendVersion>3.0.1927.0</ExpressionBlendVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>