|
| 1 | +<UserControl x:Class="OnnxStack.UI.UserControls.PaintInputControl" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 5 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 6 | + xmlns:i="http://schemas.microsoft.com/xaml/behaviors" |
| 7 | + xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" |
| 8 | + xmlns:local="clr-namespace:OnnxStack.UI.UserControls" |
| 9 | + xmlns:userControls="clr-namespace:OnnxStack.UI.UserControls" |
| 10 | + xmlns:behaviors="clr-namespace:OnnxStack.UI.Behaviors" |
| 11 | + xmlns:models="clr-namespace:OnnxStack.UI.Models" |
| 12 | + mc:Ignorable="d" |
| 13 | + d:DesignWidth="500" Name="UI" Focusable="True" PreviewKeyDown="OnPreviewKeyDown" MouseEnter="OnMouseEnter" AllowDrop="True" PreviewDrop="OnPreviewDrop"> |
| 14 | + <UserControl.Resources> |
| 15 | + <Style TargetType="{x:Type Label}"> |
| 16 | + <Setter Property="Margin" Value="-4,0,0,-4"/> |
| 17 | + </Style> |
| 18 | + </UserControl.Resources> |
| 19 | + |
| 20 | + <Border DataContext="{Binding ElementName=UI}" BorderBrush="{StaticResource ControlBrightDefaultBorderBrush}" BorderThickness="2" > |
| 21 | + <StackPanel Margin="2" > |
| 22 | + <Canvas Width="{Binding SchedulerOptions.Width}" Height="{Binding SchedulerOptions.Height}" MinHeight="512" MinWidth="512" ClipToBounds="True"> |
| 23 | + <InkCanvas x:Name="PaintCanvas" Background="{Binding BackgroundBrush}" ForceCursor="True" Cursor="Pen" MinHeight="512" MinWidth="512" |
| 24 | + PreviewMouseLeftButtonUp="PaintCanvas_MouseLeftButtonUp" |
| 25 | + PreviewMouseLeftButtonDown="PaintCanvas_MouseLeftButtonDown" |
| 26 | + PreviewMouseMove="PaintCanvas_PreviewMouseMove" |
| 27 | + EditingMode="{Binding CanvasEditingMode}" |
| 28 | + Width="{Binding SchedulerOptions.Width}" |
| 29 | + Height="{Binding SchedulerOptions.Height}" |
| 30 | + DefaultDrawingAttributes="{Binding BrushAttributes}" /> |
| 31 | + </Canvas> |
| 32 | + |
| 33 | + <UniformGrid Columns="1" Height="30" Visibility="{Binding HasResult, Converter={StaticResource BooleanToHiddenConverter}}"> |
| 34 | + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,3"> |
| 35 | + <TextBlock Text="Image File:" Margin="5,0,0,0" FontSize="10" Opacity=".6" VerticalAlignment="Center" FontStyle="Italic"/> |
| 36 | + <TextBlock Text="{Binding Result.FileName}" Margin="5,0,0,0" VerticalAlignment="Center"/> |
| 37 | + </StackPanel> |
| 38 | + </UniformGrid> |
| 39 | + <DockPanel Height="30"> |
| 40 | + <Button DockPanel.Dock="Right" Command="{Binding ClearImageCommand}" BorderThickness="0,1,1,1" Width="50" > |
| 41 | + <userControls:FontAwesome Icon="" IconStyle="Light" /> |
| 42 | + </Button> |
| 43 | + |
| 44 | + <DockPanel> |
| 45 | + <Button DockPanel.Dock="Left" Command="{Binding LoadImageCommand}" ToolTip="Load Image File" Height="30" Width="150" > |
| 46 | + <StackPanel Orientation="Horizontal"> |
| 47 | + <userControls:FontAwesome Icon="" IconStyle="Light" Size="13" /> |
| 48 | + <TextBlock Text="Load Image" Margin="5,0,0,0"/> |
| 49 | + </StackPanel> |
| 50 | + </Button> |
| 51 | + |
| 52 | + <xctk:ColorPicker |
| 53 | + Width="80" |
| 54 | + DisplayColorAndName="False" |
| 55 | + ShowRecentColors="True" |
| 56 | + SelectedColor="{Binding SelectedColor}" |
| 57 | + ShowStandardColors="False" |
| 58 | + ShowTabHeaders="False" |
| 59 | + ColorMode="ColorCanvas" |
| 60 | + AvailableColorsSortingMode="HueSaturationBrightness" > |
| 61 | + </xctk:ColorPicker> |
| 62 | + |
| 63 | + <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" > |
| 64 | + <Button DockPanel.Dock="Right" Command="{Binding CanvasModeCommand}" Width="50" Visibility="{Binding IsEraserEnabled, Converter={StaticResource BooleanToVisibilityConverter}}"> |
| 65 | + <userControls:FontAwesome Icon="" IconStyle="Light" /> |
| 66 | + </Button> |
| 67 | + <Button DockPanel.Dock="Right" Command="{Binding CanvasModeCommand}" Width="50" Visibility="{Binding IsEraserEnabled, Converter={StaticResource InverseBooleanToVisibilityConverter}}"> |
| 68 | + <userControls:FontAwesome Icon="" IconStyle="Light" /> |
| 69 | + </Button> |
| 70 | + </StackPanel> |
| 71 | + |
| 72 | + <StackPanel Margin="0,0,5,0" > |
| 73 | + <UniformGrid Columns="2" > |
| 74 | + <TextBlock Text="Pen Size" VerticalAlignment="Bottom" FontSize="8" Margin="5,-4,6,0" Opacity=".6" FontStyle="Italic" /> |
| 75 | + <TextBlock Text="{Binding ElementName=SliderMaskDrawSize, Path=Value, StringFormat={}{0}}" VerticalAlignment="Bottom" FontSize="8" Margin="0,-4,6,0" FontWeight="Medium" HorizontalAlignment="Right" /> |
| 76 | + </UniformGrid> |
| 77 | + <Slider Name="SliderMaskDrawSize" Value="{Binding BrushDrawSize}" Minimum="2" Maximum="40" TickFrequency="1" IsSnapToTickEnabled="True" SmallChange="1" LargeChange="1" > |
| 78 | + <i:Interaction.Behaviors> |
| 79 | + <behaviors:SliderMouseWheelBehavior /> |
| 80 | + </i:Interaction.Behaviors> |
| 81 | + </Slider> |
| 82 | + </StackPanel> |
| 83 | + </DockPanel> |
| 84 | + |
| 85 | + </DockPanel> |
| 86 | + </StackPanel> |
| 87 | + </Border> |
| 88 | +</UserControl> |
0 commit comments