|
9 | 9 | xmlns:s="https://github.com/canton7/Stylet" |
10 | 10 | mc:Ignorable="d" |
11 | 11 | d:DesignHeight="450" d:DesignWidth="800" |
12 | | - d:DataContext="{d:DesignInstance Type=vm:Graph, IsDesignTimeCreatable=False}"> |
13 | | - <nodify:NodifyEditor ItemsSource="{Binding Elements}" |
| 12 | + d:DataContext="{d:DesignInstance Type=vm:GraphEditor, IsDesignTimeCreatable=False}"> |
| 13 | + <UserControl.Resources> |
| 14 | + <GeometryDrawing x:Key="SmallGridGeometry" |
| 15 | + Geometry="M0,0 L0,1 0.03,1 0.03,0.03 1,0.03 1,0 Z" |
| 16 | + Brush="{DynamicResource NodifyEditor.SelectionRectangleBackgroundBrush}" /> |
| 17 | + |
| 18 | + <GeometryDrawing x:Key="LargeGridGeometry" |
| 19 | + Geometry="M0,0 L0,1 0.015,1 0.015,0.015 1,0.015 1,0 Z" |
| 20 | + Brush="{DynamicResource NodifyEditor.SelectionRectangleBackgroundBrush}" /> |
| 21 | + |
| 22 | + <DrawingBrush x:Key="SmallGridLinesDrawingBrush" |
| 23 | + TileMode="Tile" |
| 24 | + ViewportUnits="Absolute" |
| 25 | + Viewport="0 0 20 20" |
| 26 | + Transform="{Binding ViewportTransform, ElementName=EditorInstance}" |
| 27 | + Drawing="{StaticResource SmallGridGeometry}" /> |
| 28 | + |
| 29 | + <DrawingBrush x:Key="LargeGridLinesDrawingBrush" |
| 30 | + TileMode="Tile" |
| 31 | + ViewportUnits="Absolute" |
| 32 | + Opacity="0.5" |
| 33 | + Viewport="0 0 100 100" |
| 34 | + Transform="{Binding ViewportTransform, ElementName=EditorInstance}" |
| 35 | + Drawing="{StaticResource LargeGridGeometry}" /> |
| 36 | + </UserControl.Resources> |
| 37 | + |
| 38 | + <Grid Background="{StaticResource NodifyEditor.BackgroundBrush}"> |
| 39 | + <nodify:NodifyEditor ItemsSource="{Binding Elements}" |
14 | 40 | SelectedItems="{Binding SelectedElements}" |
15 | 41 | Connections="{Binding Connections}" |
16 | 42 | PendingConnection="{Binding PendingConnection}" |
17 | 43 | ViewportLocation="{Binding ViewportLocation}" |
18 | 44 | ViewportSize="{Binding ViewportSize, Mode=OneWayToSource}" |
19 | 45 | ViewportZoom="{Binding ViewportZoom}" |
20 | | - DisablePanning="{Binding DisablePanning}" |
21 | | - DisableZooming="{Binding DisableZooming}" |
22 | | - DisableAutoPanning="{Binding DisableAutoPanning}" |
23 | | - MinViewportZoom="{Binding MinViewportZoom}" |
24 | | - MaxViewportZoom="{Binding MaxViewportZoom}" |
25 | | - GridCellSize="{Binding GridSnapSize}" |
26 | | - EnableRealtimeSelection="{Binding EnableRealtimeSelection}" |
| 46 | + DisablePanning="{Binding Settings.DisablePanning}" |
| 47 | + DisableZooming="{Binding Settings.DisableZooming}" |
| 48 | + DisableAutoPanning="{Binding Settings.DisableAutoPanning}" |
| 49 | + MinViewportZoom="{Binding Settings.MinViewportZoom}" |
| 50 | + MaxViewportZoom="{Binding Settings.MaxViewportZoom}" |
| 51 | + GridCellSize="{Binding Settings.GridSnapSize}" |
| 52 | + EnableRealtimeSelection="{Binding Settings.EnableRealtimeSelection}" |
27 | 53 | x:Name="EditorInstance"> |
28 | | - <nodify:NodifyEditor.ItemContainerStyle> |
29 | | - <Style TargetType="nodify:ItemContainer"> |
30 | | - <Setter Property="Location" Value="{Binding Location, Mode=TwoWay}" /> |
31 | | - <Setter Property="ActualSize" Value="{Binding Size, Mode=OneWayToSource}" /> |
32 | | - <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" /> |
33 | | - <Setter Property="IsSelectable" Value="{Binding IsSelectable}" /> |
34 | | - <Setter Property="IsDraggable" Value="{Binding IsDraggable}" /> |
35 | | - </Style> |
36 | | - </nodify:NodifyEditor.ItemContainerStyle> |
37 | | - <nodify:NodifyEditor.ItemTemplate> |
38 | | - <DataTemplate> |
39 | | - <ContentControl s:View.Model="{Binding}" /> |
40 | | - </DataTemplate> |
41 | | - </nodify:NodifyEditor.ItemTemplate> |
42 | | - <nodify:NodifyEditor.PendingConnectionTemplate> |
43 | | - <DataTemplate> |
44 | | - <ContentControl s:View.Model="{Binding}" /> |
45 | | - </DataTemplate> |
46 | | - </nodify:NodifyEditor.PendingConnectionTemplate> |
47 | | - <nodify:NodifyEditor.ConnectionTemplate> |
48 | | - <DataTemplate> |
49 | | - <ContentControl s:View.Model="{Binding}" /> |
50 | | - </DataTemplate> |
51 | | - </nodify:NodifyEditor.ConnectionTemplate> |
52 | | - </nodify:NodifyEditor> |
| 54 | + <nodify:NodifyEditor.Style> |
| 55 | + <Style TargetType="{x:Type nodify:NodifyEditor}" BasedOn="{StaticResource {x:Type nodify:NodifyEditor}}"> |
| 56 | + <Style.Triggers> |
| 57 | + <DataTrigger Binding="{Binding Settings.ShowGridLines}" Value="True"> |
| 58 | + <Setter Property="Background" Value="{StaticResource SmallGridLinesDrawingBrush}" /> |
| 59 | + </DataTrigger> |
| 60 | + </Style.Triggers> |
| 61 | + </Style> |
| 62 | + </nodify:NodifyEditor.Style> |
| 63 | + <nodify:NodifyEditor.ItemContainerStyle> |
| 64 | + <Style TargetType="nodify:ItemContainer"> |
| 65 | + <Setter Property="Location" Value="{Binding Location, Mode=TwoWay}" /> |
| 66 | + <Setter Property="ActualSize" Value="{Binding Size, Mode=OneWayToSource}" /> |
| 67 | + <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" /> |
| 68 | + <Setter Property="IsSelectable" Value="{Binding IsSelectable}" /> |
| 69 | + <Setter Property="IsDraggable" Value="{Binding IsDraggable}" /> |
| 70 | + </Style> |
| 71 | + </nodify:NodifyEditor.ItemContainerStyle> |
| 72 | + <nodify:NodifyEditor.ItemTemplate> |
| 73 | + <DataTemplate> |
| 74 | + <ContentControl s:View.Model="{Binding}" /> |
| 75 | + </DataTemplate> |
| 76 | + </nodify:NodifyEditor.ItemTemplate> |
| 77 | + <nodify:NodifyEditor.PendingConnectionTemplate> |
| 78 | + <DataTemplate> |
| 79 | + <ContentControl s:View.Model="{Binding}" /> |
| 80 | + </DataTemplate> |
| 81 | + </nodify:NodifyEditor.PendingConnectionTemplate> |
| 82 | + <nodify:NodifyEditor.ConnectionTemplate> |
| 83 | + <DataTemplate> |
| 84 | + <ContentControl s:View.Model="{Binding}" /> |
| 85 | + </DataTemplate> |
| 86 | + </nodify:NodifyEditor.ConnectionTemplate> |
| 87 | + </nodify:NodifyEditor> |
| 88 | + |
| 89 | + <Grid Background="{StaticResource LargeGridLinesDrawingBrush}" |
| 90 | + Panel.ZIndex="-2" /> |
| 91 | + </Grid> |
53 | 92 | </UserControl> |
0 commit comments