We can set a margin to an annotation.
--- a/src/FingersDance.Views/TimelineAnnotationView.xaml Wed Sep 16 17:46:19 2009 +0200
+++ b/src/FingersDance.Views/TimelineAnnotationView.xaml Wed Sep 16 19:32:26 2009 +0200
@@ -6,9 +6,13 @@
xmlns:Custom="http://schemas.microsoft.com/surface/2008"
mc:Ignorable="d"
x:Class="FingersDance.Views.TimelineAnnotationView"
+ xmlns:vw="clr-namespace:FingersDance.Views"
x:Name="UserControl"
d:DesignWidth="640" d:DesignHeight="480">
- <Grid x:Name="LayoutRoot" Margin="0,0,0,0">
+ <UserControl.Resources>
+ <vw:ThicknessSingleValueConverter x:Name="myThicknessSingleValueConverter" x:Key="myThicknessSingleValueConverter"></vw:ThicknessSingleValueConverter>
+ </UserControl.Resources>
+ <Grid x:Name="LayoutRoot" Margin="{Binding Path=TcBegin, Converter={StaticResource myThicknessSingleValueConverter}}">
<Rectangle Fill="Green" HorizontalAlignment="Left" VerticalAlignment="Top" Width="4" Height="20"/>
<TextBox Text="{Binding Path=GestureType}" Width="100" Margin="5,0,0,0"/>
</Grid>
--- a/src/FingersDance.Views/TimelineAnnotationView.xaml.cs Wed Sep 16 17:46:19 2009 +0200
+++ b/src/FingersDance.Views/TimelineAnnotationView.xaml.cs Wed Sep 16 19:32:26 2009 +0200
@@ -24,4 +24,20 @@
InitializeComponent();
}
}
+
+ public class ThicknessSingleValueConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ ThicknessConverter myThicknessConverter = new ThicknessConverter();
+ Thickness th1 = (Thickness)myThicknessConverter.ConvertFrom(value);
+ th1.Top = th1.Top;
+ return th1;
+ }
+ public object ConvertBack(object value, Type targetTypes, object parameter, System.Globalization.CultureInfo culture)
+ {
+ Thickness thickness = (Thickness)value;
+ return thickness.Left;
+ }
+ }
}