319 lines
30 KiB
XML
319 lines
30 KiB
XML
<Window x:Class="StructureHelper.MainView"
|
|
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"
|
|
xmlns:local="clr-namespace:StructureHelper"
|
|
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
|
xmlns:infrastructure="clr-namespace:StructureHelper.Infrastructure"
|
|
mc:Ignorable="d"
|
|
d:DataContext="{d:DesignInstance local:MainViewModel}"
|
|
Title="StructureHelper" Height="700" Width="1000">
|
|
<Window.InputBindings>
|
|
<KeyBinding Command="{Binding SetParameters}" Key="Enter"/>
|
|
</Window.InputBindings>
|
|
<Window.Resources>
|
|
<DataTemplate x:Key="rectangleTemplate">
|
|
<DockPanel>
|
|
<Border x:Name="Border" Width="{Binding BorderWidth, Mode=TwoWay}" Height="{Binding BorderHeight, Mode=TwoWay}" Background="{Binding Brush, Mode=TwoWay}"
|
|
Opacity="{Binding Opacity, Mode=TwoWay}">
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="PreviewMouseDown">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PrimitiveLeftButtonDown}" CommandParameter="{Binding}"/>
|
|
</i:EventTrigger>
|
|
<i:EventTrigger EventName="PreviewMouseUp">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PrimitiveLeftButtonUp}" CommandParameter="{Binding}"/>
|
|
</i:EventTrigger>
|
|
<i:EventTrigger EventName="PreviewMouseMove">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.BorderPreviewMouseMove}" CommandParameter="{Binding}"/>
|
|
</i:EventTrigger>
|
|
<infrastructure:DoubleClickEventTrigger EventName="MouseDown">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PrimitiveDoubleClick}" CommandParameter="{Binding}"/>
|
|
</infrastructure:DoubleClickEventTrigger>
|
|
</i:Interaction.Triggers>
|
|
<Border.ToolTip>
|
|
<ToolTip Background="White" BorderBrush="Black" BorderThickness="1">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="30"/>
|
|
<RowDefinition Height="30"/>
|
|
<RowDefinition Height="30"/>
|
|
<RowDefinition Height="30"/>
|
|
<RowDefinition Height="30"/>
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="100"/>
|
|
<ColumnDefinition Width="50"/>
|
|
</Grid.ColumnDefinitions>
|
|
<TextBox Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Координата X:"/>
|
|
<TextBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding ShowedRectX}"/>
|
|
<TextBox Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Координата Y:"/>
|
|
<TextBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding ShowedRectY}"/>
|
|
<TextBox Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Ширина:"/>
|
|
<TextBox Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding BorderWidth}"/>
|
|
<TextBox Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Высота:"/>
|
|
<TextBox Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding BorderHeight}"/>
|
|
<TextBox Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Материал:"/>
|
|
<TextBox Grid.Row="4" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding MaterialName, Mode=TwoWay}"/>
|
|
</Grid>
|
|
</ToolTip>
|
|
</Border.ToolTip>
|
|
<Rectangle Name="testRect" Fill="{Binding Brush, Mode=TwoWay}" Width="20" Height="20" StrokeThickness="2" Stroke="{Binding Brush, Mode=TwoWay}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Cursor="SizeNWSE">
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="PreviewMouseDown">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.LeftButtonDown}" CommandParameter="{Binding}"/>
|
|
</i:EventTrigger>
|
|
<i:EventTrigger EventName="PreviewMouseUp">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.LeftButtonUp}" CommandParameter="{Binding}"/>
|
|
</i:EventTrigger>
|
|
<i:EventTrigger EventName="PreviewMouseMove">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PreviewMouseMove}" CommandParameter="{Binding}"/>
|
|
</i:EventTrigger>
|
|
</i:Interaction.Triggers>
|
|
</Rectangle>
|
|
</Border>
|
|
<Popup IsOpen="{Binding ParamsPanelVisibilty}">
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="MouseLeave">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetPopupCanBeClosedTrue}" CommandParameter="{Binding}"/>
|
|
</i:EventTrigger>
|
|
<i:EventTrigger EventName="MouseEnter">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetPopupCanBeClosedFalse}" CommandParameter="{Binding}"/>
|
|
</i:EventTrigger>
|
|
</i:Interaction.Triggers>
|
|
<Border Background="White" BorderBrush="Black" BorderThickness="1">
|
|
<Grid Grid.Column="1">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="170"/>
|
|
<ColumnDefinition Width="170"/>
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="Координата X" Margin="10"/>
|
|
<TextBox Grid.Column="1" VerticalAlignment="Center" Margin="10" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.RectParameterX, Mode=TwoWay}"/>
|
|
<TextBlock Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Text="Координата Y" Margin="10"/>
|
|
<TextBox Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" Margin="10" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.RectParameterY, Mode=TwoWay}"/>
|
|
<TextBlock Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left" Text="Ширина" Margin="10"/>
|
|
<TextBox Grid.Column="1" Grid.Row="2" VerticalAlignment="Center" Margin="10" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.RectParameterWidth, Mode=TwoWay}"/>
|
|
<TextBlock Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Left" Text="Высота" Margin="10"/>
|
|
<TextBox Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" Margin="10" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.RectParameterHeight, Mode=TwoWay}"/>
|
|
<TextBlock Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Left" Text="Материал" Margin="10"/>
|
|
<Button Grid.Row="4" Grid.Column="1" Margin="10" Background="White"
|
|
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.OpenMaterialCatalogWithSelection}" CommandParameter="{Binding}"
|
|
Content="{Binding MaterialName, Mode=TwoWay}"/>
|
|
<TextBlock Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Цвет"/>
|
|
<Button Grid.Row="5" Grid.Column="1" Margin="10" Background="{Binding Brush, Mode=TwoWay}"
|
|
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetColor}" CommandParameter="{Binding}"/>
|
|
<TextBlock Grid.Row="6" Margin="10" VerticalAlignment="Center" HorizontalAlignment="Left" Text="Прозрачность"/>
|
|
<TextBox Grid.Row="6" Grid.Column="1" VerticalAlignment="Center" Margin="10,10,50,10" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.ParameterOpacity, Mode=TwoWay}"/>
|
|
<TextBlock Grid.Row="6" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" Text="%" Margin="25,10"/>
|
|
<TextBlock Grid.Row="7" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Заблокировать объект" Grid.ColumnSpan="2"/>
|
|
<CheckBox Grid.Row="7" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.ElementLock, Mode=TwoWay}"></CheckBox>
|
|
<TextBlock Grid.Row="8" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Z-порядок"/>
|
|
<StackPanel Grid.Row="8" Grid.Column="1" Orientation="Horizontal">
|
|
<TextBox VerticalAlignment="Center" HorizontalAlignment="Left" Width="50" Margin="10"
|
|
Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PrimitiveIndex, Mode=TwoWay}"/>
|
|
<TextBlock VerticalAlignment="Center" Text="Max = "/>
|
|
<TextBlock VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PrimitivesCount, Mode=TwoWay}"/>
|
|
</StackPanel>
|
|
<Button Grid.Row="9" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Установить впереди всех" Margin="10"
|
|
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetInFrontOfAll}" CommandParameter="{Binding}"/>
|
|
<Button Grid.Row="9" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Установить позади всех" Margin="10"
|
|
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetInBackOfAll}" CommandParameter="{Binding}"/>
|
|
<Button Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="10" Content="Установить параметры"
|
|
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetParameters}" CommandParameter="{Binding}"/>
|
|
</Grid>
|
|
</Border>
|
|
</Popup>
|
|
</DockPanel>
|
|
</DataTemplate>
|
|
<DataTemplate x:Key="ellipseTemplate">
|
|
<DockPanel>
|
|
<Ellipse Width="{Binding Diameter}" Height="{Binding Diameter}" Fill="{Binding Brush, Mode=TwoWay}" Opacity="{Binding Opacity, Mode=TwoWay}">
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="PreviewMouseDown">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PrimitiveLeftButtonDown}" CommandParameter="{Binding}"/>
|
|
</i:EventTrigger>
|
|
<i:EventTrigger EventName="PreviewMouseUp">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PrimitiveLeftButtonUp}" CommandParameter="{Binding}"/>
|
|
</i:EventTrigger>
|
|
<i:EventTrigger EventName="PreviewMouseMove">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.EllipsePreviewMouseMove}" CommandParameter="{Binding}"/>
|
|
</i:EventTrigger>
|
|
<infrastructure:DoubleClickEventTrigger EventName="MouseDown">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PrimitiveDoubleClick}" CommandParameter="{Binding}"/>
|
|
</infrastructure:DoubleClickEventTrigger>
|
|
</i:Interaction.Triggers>
|
|
<Ellipse.ToolTip>
|
|
<ToolTip Background="White" BorderBrush="Black" BorderThickness="1">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="30"/>
|
|
<RowDefinition Height="30"/>
|
|
<RowDefinition Height="30"/>
|
|
<RowDefinition Height="30"/>
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="150"/>
|
|
<ColumnDefinition Width="50"/>
|
|
</Grid.ColumnDefinitions>
|
|
<TextBox Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Координата центра X:"/>
|
|
<TextBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding ShowedEllipseX}"/>
|
|
<TextBox Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Координата центра Y:"/>
|
|
<TextBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding ShowedEllipseY}"/>
|
|
<TextBox Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Диаметр:"/>
|
|
<TextBox Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding ShowedDiameter}"/>
|
|
<TextBox Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="Материал:"/>
|
|
<TextBox Grid.Row="4" Grid.Column="1" VerticalAlignment="Center" Margin="3" BorderThickness="0" Text="{Binding MaterialName, Mode=TwoWay}"/>
|
|
</Grid>
|
|
</ToolTip>
|
|
</Ellipse.ToolTip>
|
|
</Ellipse>
|
|
<Popup IsOpen="{Binding ParamsPanelVisibilty}">
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="MouseLeave">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetPopupCanBeClosedTrue}" CommandParameter="{Binding}"/>
|
|
</i:EventTrigger>
|
|
<i:EventTrigger EventName="MouseEnter">
|
|
<i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetPopupCanBeClosedFalse}" CommandParameter="{Binding}"/>
|
|
</i:EventTrigger>
|
|
</i:Interaction.Triggers>
|
|
<Border Background="White" BorderBrush="Black" BorderThickness="1">
|
|
<Grid Grid.Column="1">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="170"/>
|
|
<ColumnDefinition Width="170"/>
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="Координата центра X" Margin="10"/>
|
|
<TextBox Grid.Column="1" VerticalAlignment="Center" Margin="10" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.EllipseParameterX, Mode=TwoWay}"/>
|
|
<TextBlock Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Text="Координата центра Y" Margin="10"/>
|
|
<TextBox Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" Margin="10" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.EllipseParameterY, Mode=TwoWay}"/>
|
|
<TextBlock Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Left" Text="Площадь" Margin="10"/>
|
|
<TextBox Grid.Column="1" Grid.Row="2" VerticalAlignment="Center" Margin="10" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.EllipseParameterSquare, Mode=TwoWay}"/>
|
|
<TextBlock Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Left" Text="Материал" Margin="10"/>
|
|
<Button Grid.Row="4" Grid.Column="1" Margin="10" Background="White"
|
|
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.OpenMaterialCatalogWithSelection}" CommandParameter="{Binding}"
|
|
Content="{Binding MaterialName, Mode=TwoWay}"/>
|
|
<TextBlock Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Цвет"/>
|
|
<Button Grid.Row="5" Grid.Column="1" Margin="10" Background="{Binding Brush, Mode=TwoWay}"
|
|
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetColor}" CommandParameter="{Binding}"/>
|
|
<TextBlock Grid.Row="6" Margin="10" VerticalAlignment="Center" HorizontalAlignment="Left" Text="Прозрачность"/>
|
|
<TextBox Grid.Row="6" Grid.Column="1" VerticalAlignment="Center" Margin="10,10,50,10" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.ParameterOpacity, Mode=TwoWay}"/>
|
|
<TextBlock Grid.Row="6" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" Text="%" Margin="25,10"/>
|
|
<TextBlock Grid.Row="7" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Заблокировать объект" Grid.ColumnSpan="2"/>
|
|
<CheckBox Grid.Row="7" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.ElementLock, Mode=TwoWay}"></CheckBox>
|
|
<TextBlock Grid.Row="8" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Text="Z-порядок"/>
|
|
<StackPanel Grid.Row="8" Grid.Column="1" Orientation="Horizontal">
|
|
<TextBox VerticalAlignment="Center" HorizontalAlignment="Left" Width="50" Margin="10"
|
|
Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PrimitiveIndex, Mode=TwoWay}"/>
|
|
<TextBlock VerticalAlignment="Center" Text="Max = "/>
|
|
<TextBlock VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.PrimitivesCount, Mode=TwoWay}"/>
|
|
</StackPanel>
|
|
<Button Grid.Row="9" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Установить впереди всех" Margin="10"
|
|
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetInFrontOfAll}" CommandParameter="{Binding}"/>
|
|
<Button Grid.Row="9" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Установить позади всех" Margin="10"
|
|
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetInBackOfAll}" CommandParameter="{Binding}"/>
|
|
<Button Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="10" Content="Установить параметры"
|
|
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}, Path=DataContext.SetParameters}" CommandParameter="{Binding}"/>
|
|
</Grid>
|
|
</Border>
|
|
</Popup>
|
|
</DockPanel>
|
|
</DataTemplate>
|
|
</Window.Resources>
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*"/>
|
|
<RowDefinition Height="40"/>
|
|
<RowDefinition Height="40"/>
|
|
</Grid.RowDefinitions>
|
|
<Border BorderBrush="Black" Background="White" BorderThickness="1" Margin="5">
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="PreviewMouseDown">
|
|
<i:InvokeCommandAction Command="{Binding ClearSelection}" CommandParameter="{Binding}"/>
|
|
</i:EventTrigger>
|
|
</i:Interaction.Triggers>
|
|
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible">
|
|
<Canvas ClipToBounds="True" Width="{Binding CanvasWidth}" Height="{Binding CanvasHeight}">
|
|
<i:Interaction.Behaviors>
|
|
<local:MouseBehaviour MouseX="{Binding PanelX, Mode=OneWayToSource}" MouseY="{Binding PanelY, Mode=OneWayToSource}"/>
|
|
</i:Interaction.Behaviors>
|
|
<i:Interaction.Triggers>
|
|
<infrastructure:MouseWheelDownEventTrigger EventName="PreviewMouseWheel">
|
|
<i:InvokeCommandAction Command="{Binding ScaleCanvasDown}" CommandParameter="{Binding}"/>
|
|
</infrastructure:MouseWheelDownEventTrigger>
|
|
<infrastructure:MouseWheelUpEventTrigger EventName="PreviewMouseWheel">
|
|
<i:InvokeCommandAction Command="{Binding ScaleCanvasUp}" CommandParameter="{Binding}"/>
|
|
</infrastructure:MouseWheelUpEventTrigger>
|
|
</i:Interaction.Triggers>
|
|
<Canvas.RenderTransform>
|
|
<TransformGroup>
|
|
<ScaleTransform ScaleX="{Binding ScaleValue}" ScaleY="{Binding ScaleValue}"
|
|
CenterX="{Binding ScrollPanelX}" CenterY="{Binding ScrollPanelY}"/>
|
|
</TransformGroup>
|
|
</Canvas.RenderTransform>
|
|
<Canvas.Background>
|
|
<DrawingBrush Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile">
|
|
<DrawingBrush.Drawing>
|
|
<GeometryDrawing Brush="Black">
|
|
<GeometryDrawing.Geometry>
|
|
<GeometryGroup FillRule="EvenOdd">
|
|
<RectangleGeometry Rect="0,0,50,50"/>
|
|
<RectangleGeometry Rect="0,0,49.5,49.5"/>
|
|
</GeometryGroup>
|
|
</GeometryDrawing.Geometry>
|
|
</GeometryDrawing>
|
|
</DrawingBrush.Drawing>
|
|
</DrawingBrush>
|
|
</Canvas.Background>
|
|
<Line X1="0" X2="{Binding XX2}" Y1="{Binding XY1}" Y2="{Binding XY1}" Stroke="Red" StrokeThickness="1"/>
|
|
<Line X1="{Binding YX1}" X2="{Binding YX1}" Y1="0" Y2="{Binding YY2}" Stroke="ForestGreen" StrokeThickness="1"/>
|
|
<ItemsControl ItemsSource="{Binding Primitives}" ItemTemplate="{Binding}">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<Canvas/>
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemContainerStyle>
|
|
<Style TargetType="ContentPresenter">
|
|
<Setter Property="Canvas.ZIndex" Value="{Binding ZIndex}"/>
|
|
<Setter Property="Canvas.Left" Value="{Binding X}"/>
|
|
<Setter Property="Canvas.Top" Value="{Binding Y}"/>
|
|
</Style>
|
|
</ItemsControl.ItemContainerStyle>
|
|
</ItemsControl>
|
|
</Canvas>
|
|
</ScrollViewer>
|
|
</Border>
|
|
<Button Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10" Content="Справочник" Command="{Binding OpenMaterialCatalog}"/>
|
|
<Button Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="10" Content="Добавить прямоугольник" Command="{Binding AddRectangle}"/>
|
|
<Button Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="10" Content="Добавить точку" Command="{Binding AddEllipse}"/>
|
|
</Grid>
|
|
</Window>
|