*我试图触发scrollviewer,但它不起作用,因为我认为它取决于内容模板的父对象。对不起英语不好。在一个循环中有一个声明,它检查它是否满足某些语句,如果它满足此modiefier出现。
后端
Vector post = new Vector(60, 40);
positionTM = positionTM + post;
tblLvl1 = new TableObjects(
Application.Current.Resources["ShapeTS"] as ControlTemplate,
DependencyList[i].ObjectName,
"/assets/item.png",
positionTM,
rep.OnDragDelta,
DependencyList[j].ID,
DependencyList[j].RelatedObjectID, DependencyList[j].StartTime, DependencyList[j].RowsInserted, DependencyList[j].ExecutionTime);
tblLvl1.DataContext = tblLvl1;
rep.mycanvas.Children.Add(tblLvl1);
rep.connection.Children.Add(tblLvl1.LinkTo(tblLvl0));
前端:
<ScrollViewer
x:Name="scroller"
CanContentScroll="True"
VerticalScrollBarVisibility="Visible"
HorizontalScrollBarVisibility="Visible"
>
<Grid x:Name="sqlrelation">
<Grid.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Grid.RenderTransform>
<StackPanel VerticalAlignment="Top" HorizontalAlignment="Right" Height="30" Orientation="Horizontal" Background="#FF837F7F" >
<Button Click="Enlarge_Click" ToolTip="Enlarge">
<Image Source="assets/enlarge.png"></Image>
</Button>
</StackPanel>
<Canvas Name="mycanvas" MouseWheel="Mycanvas_MouseWheel"
>
<Canvas.RenderTransform>
<MatrixTransform/>
</Canvas.RenderTransform>
<Canvas>
<Path Stroke="#FF2062A3" StrokeThickness="3">
<Path.Data>
<GeometryGroup x:Name="connection"></GeometryGroup>
</Path.Data>
</Path>
</Canvas>
</Canvas>
</Grid>
</ScrollViewer>